From b91b195494b87324813694caae0ab2e0fee57543 Mon Sep 17 00:00:00 2001 From: Quentin Torgerson Date: Sat, 26 Feb 2022 12:23:16 -0500 Subject: [PATCH] Fix `refine_edges()` Corner Ordering (#188) * fix issue with refine_edges reordering the apriltag corners, causing failures in the fallback case --- apriltag.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apriltag.c b/apriltag.c index 73b7bfc9..768315ec 100644 --- a/apriltag.c +++ b/apriltag.c @@ -864,9 +864,10 @@ static void refine_edges(apriltag_detector_t *td, image_u8_t *im_orig, struct qu double L0 = W00*B0 + W01*B1; - // compute intersection - quad->p[i][0] = lines[i][0] + L0*A00; - quad->p[i][1] = lines[i][1] + L0*A10; + // Compute intersection. Note that line i represents the line from corner i to (i+1)&3, so + // the intersection of line i with line (i+1)&3 represents corner (i+1)&3. + quad->p[(i+1)&3][0] = lines[i][0] + L0*A00; + quad->p[(i+1)&3][1] = lines[i][1] + L0*A10; } else { // this is a bad sign. We'll just keep the corner we had. // printf("bad det: %15f %15f %15f %15f %15f\n", A00, A11, A10, A01, det);