@@ -102,7 +102,6 @@ struct cluster_task
102102 int w ;
103103 int s ;
104104 int nclustermap ;
105- int min_cluster_pixels ;
106105 unionfind_t * uf ;
107106 image_u8_t * im ;
108107 zarray_t * clusters ;
@@ -1568,7 +1567,7 @@ unionfind_t* connected_components(apriltag_detector_t *td, image_u8_t* threshim,
15681567 return uf ;
15691568}
15701569
1571- zarray_t * do_gradient_clusters (image_u8_t * threshim , int ts , int y0 , int y1 , int w , int nclustermap , int min_cluster_pixels , unionfind_t * uf , zarray_t * clusters ) {
1570+ zarray_t * do_gradient_clusters (image_u8_t * threshim , int ts , int y0 , int y1 , int w , int nclustermap , unionfind_t * uf , zarray_t * clusters ) {
15721571 struct uint64_zarray_entry * * clustermap = calloc (nclustermap , sizeof (struct uint64_zarray_entry * ));
15731572
15741573 int mem_chunk_size = 2048 ;
@@ -1589,7 +1588,7 @@ zarray_t* do_gradient_clusters(image_u8_t* threshim, int ts, int y0, int y1, int
15891588
15901589 // XXX don't query this until we know we need it?
15911590 uint64_t rep0 = unionfind_get_representative (uf , y * w + x );
1592- if (( int ) unionfind_get_set_size (uf , rep0 ) < min_cluster_pixels ) {
1591+ if (unionfind_get_set_size (uf , rep0 ) < 25 ) {
15931592 connected_last = false;
15941593 continue ;
15951594 }
@@ -1621,7 +1620,7 @@ zarray_t* do_gradient_clusters(image_u8_t* threshim, int ts, int y0, int y1, int
16211620 \
16221621 if (v0 + v1 == 255) { \
16231622 uint64_t rep1 = unionfind_get_representative(uf, (y + dy)*w + x + dx); \
1624- if ((int) unionfind_get_set_size(uf, rep1) >= min_cluster_pixels ) { \
1623+ if (unionfind_get_set_size(uf, rep1) > 24 ) { \
16251624 uint64_t clusterid; \
16261625 if (rep0 < rep1) \
16271626 clusterid = (rep1 << 32) + rep0; \
@@ -1716,7 +1715,7 @@ static void do_cluster_task(void *p)
17161715{
17171716 struct cluster_task * task = (struct cluster_task * ) p ;
17181717
1719- do_gradient_clusters (task -> im , task -> s , task -> y0 , task -> y1 , task -> w , task -> nclustermap , task -> min_cluster_pixels , task -> uf , task -> clusters );
1718+ do_gradient_clusters (task -> im , task -> s , task -> y0 , task -> y1 , task -> w , task -> nclustermap , task -> uf , task -> clusters );
17201719}
17211720
17221721zarray_t * merge_clusters (zarray_t * c1 , zarray_t * c2 ) {
@@ -1779,7 +1778,6 @@ zarray_t* gradient_clusters(apriltag_detector_t *td, image_u8_t* threshim, int w
17791778 tasks [ntasks ].uf = uf ;
17801779 tasks [ntasks ].im = threshim ;
17811780 tasks [ntasks ].nclustermap = nclustermap /(sz / chunksize + 1 );
1782- tasks [ntasks ].min_cluster_pixels = td -> qtp .min_cluster_pixels ;
17831781 tasks [ntasks ].clusters = zarray_create (sizeof (struct cluster_hash * ));
17841782
17851783 workerpool_add_task (td -> wp , do_cluster_task , & tasks [ntasks ]);
0 commit comments