diff options
author | Christian C <cc@localhost> | 2025-03-05 20:53:40 -0800 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-03-05 20:53:40 -0800 |
commit | 74ae06a582b7c567caf3c04e5bf5dfabf6671f31 (patch) | |
tree | c73df879087bce2f3b8d6f09acaf378814027c66 /src/main.c | |
parent | ffeadedd0510cb7194058c8c66c21b57f6fa02f2 (diff) |
Closing up label gaps
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -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 |