[gegl] slic: ignore the iterations parameter when there is only one cluster



commit e319aaa380c0d049d4870b27124c31bee2e29b50
Author: Thomas Manni <thomas manni free fr>
Date:   Mon May 16 10:37:45 2022 +0200

    slic: ignore the iterations parameter when there is only one cluster

 operations/common/slic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/operations/common/slic.c b/operations/common/slic.c
index 575511f37..410d77814 100644
--- a/operations/common/slic.c
+++ b/operations/common/slic.c
@@ -384,6 +384,7 @@ process (GeglOperation       *operation,
   GArray     *clusters;
   gint        max_dim;
   gint        cluster_size;
+  gint        n_iterations;
   gint        i;
 
   labels = gegl_buffer_new (src_region, babl_format_n (babl_type ("u32"), 1));
@@ -399,7 +400,9 @@ process (GeglOperation       *operation,
 
   /* perform segmentation */
 
-  for (i = 0; i < o->iterations; i++)
+  n_iterations = clusters->len > 1 ? o->iterations : 1;
+
+  for (i = 0; i < n_iterations; i++)
     {
       assign_labels (labels,
                      input,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]