aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorChristian C <cc@localhost>2025-03-05 20:53:40 -0800
committerChristian C <cc@localhost>2025-03-05 20:53:40 -0800
commit74ae06a582b7c567caf3c04e5bf5dfabf6671f31 (patch)
treec73df879087bce2f3b8d6f09acaf378814027c66 /src/main.c
parentffeadedd0510cb7194058c8c66c21b57f6fa02f2 (diff)
Closing up label gaps
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c19
1 files changed, 10 insertions, 9 deletions
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