From 74ae06a582b7c567caf3c04e5bf5dfabf6671f31 Mon Sep 17 00:00:00 2001 From: Christian C Date: Wed, 5 Mar 2025 20:53:40 -0800 Subject: Closing up label gaps --- src/main.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 5746cd8..7c914e5 100644 --- a/src/main.c +++ b/src/main.c @@ -17,7 +17,7 @@ #define OFFSET 16 -#define N_DILATIONS 0 +#define N_DILATIONS 10 #define MIN_AREA 200 #define MIN_PERIMETER 50 @@ -104,14 +104,6 @@ int main(int argc, char** argv) free(labels); printf("%u labels found\n", starting_label-1); printf("Mask dimensions: %u %u\n", width, height); - TIME(ts_start); - for (uint16_t count = 0; count < N_DILATIONS; count++) { - uint16_t *new_labels = dilate(masks, width, height); - free(masks); - masks = new_labels; - } - TIME(ts_end); - printf("Dilation took %f ms\n", 1000*diff_time(&ts_end, &ts_start)); // Get the area/ perimeter of each label root = NULL; TIME(ts_info_start); @@ -191,6 +183,15 @@ int main(int argc, char** argv) #endif free_avl_tree_nodes(root); + TIME(ts_start); + uint16_t *new_labels = closeup(masks, width, height, N_DILATIONS); + if (new_labels != NULL) { + free(masks); + masks = new_labels; + } + TIME(ts_end); + printf("Dilation took %f ms\n", 1000*diff_time(&ts_end, &ts_start)); + //----------------------------------------------- #ifdef VISUAL -- cgit v1.2.1