Skip to content

Commit 02674c1

Browse files
authored
Remove redundant cluster size check (#423)
Since fit_quad checks that the cluster size is above 24, the min_cluster_pixels comparision is essentially useless for values below 24. Invert it so that min_cluster_pixels is now 24, and remove the now redundant hardcoded 24 check. Move the size variable down as well for better locality of behavior.
1 parent 8c52e4c commit 02674c1

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

apriltag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ apriltag_detector_t *apriltag_detector_create()
378378
td->quad_sigma = 0.0;
379379

380380
td->qtp.max_nmaxima = 10;
381-
td->qtp.min_cluster_pixels = 5;
381+
td->qtp.min_cluster_pixels = 24;
382382

383383
td->qtp.max_line_fit_mse = 10.0;
384384
td->qtp.cos_critical_rad = cos(10 * M_PI / 180);

apriltag_quad_thresh.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -778,10 +778,6 @@ int fit_quad(
778778
bool reversed_border) {
779779
int res = 0;
780780

781-
int sz = zarray_size(cluster);
782-
if (sz < 24) // Synchronize with later check.
783-
return 0;
784-
785781
/////////////////////////////////////////////////////////////
786782
// Step 1. Sort points so they wrap around the center of the
787783
// quad. We will constrain our quad fit to simply partition this
@@ -866,6 +862,7 @@ int fit_quad(
866862
ptsort((struct pt*) cluster->data, zarray_size(cluster));
867863
}
868864

865+
int sz = zarray_size(cluster);
869866
struct line_fit_pt *lfps = compute_lfps(sz, cluster, im);
870867

871868
int indices[4];

0 commit comments

Comments
 (0)