[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 08:40:24 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
Resolution: | Keywords: i.superpixels.slic convergence
CPU: | color
Unspecified | Platform: Unspecified
-------------------------+-------------------------------------------------
Comment (by mmetz):
Replying to [ticket:3892 mlennert]:
> 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 ?
Homogeneous input has been fixed in a01f12c5, including your fix for color
definitions.
Note that in case of homogeneous input, i.superpixels.slic will produce as
many superpixels as there are seeds, not only one superpixel, because the
distance to a superpixel center is considered together with spectral
similarity.
>
> 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#comment:1>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list