[GRASS-dev] [GRASS GIS] #3892: i.superpixels.slic: if kmeans converges, result should be one superpixel, not NULL

GRASS GIS trac at osgeo.org
Fri Aug 16 06:33:22 PDT 2019


#3892: i.superpixels.slic: if kmeans converges, result should be one superpixel,
not NULL
-------------------------------------------------+-------------------------
 Reporter:  mlennert                             |      Owner:  grass-dev@…
     Type:  defect                               |     Status:  new
 Priority:  normal                               |  Milestone:
Component:  Addons                               |    Version:  unspecified
 Keywords:  i.superpixels.slic convergence       |        CPU:  Unspecified
  color                                          |
 Platform:  Unspecified                          |
-------------------------------------------------+-------------------------
 In an automated script in which I run i.superpixels.slic, I sometimes have
 the situation that the zone I run the latter on is very small and very
 homogeneous leading to a convergence within the very first iteration of
 the kmeans in i.superpixels.slic (given the automatically determined
 parameter settings). I am ok with the entire area being considered as one
 single superpixel and would thus expect i.superpixels to label all pixels
 with 1. However, it labels all pixels with NULL. Is there any reason not
 to label a single superpixel ?

 Somewhat as a side note, i.superpixels.slic crashes in that situation
 because of the color definition call in main.c (lines 707+708):

 {{{
             Rast_make_random_colors(&colors, 1, numlabels);
             Rast_write_colors(outname, G_mapset(), &colors);
 }}}

 This can be easily solved by wrapping these calls into a check:

 {{{
     if (numlabels > 1) {
             Rast_make_random_colors(&colors, 1, numlabels);
             Rast_write_colors(outname, G_mapset(), &colors);
     }
 }}}.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3892>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list