Referring and quoting the SNIC (Simple Non-Iterative Clustering) paper:

In each k-means iteration, SLIC evolves a centroid by computing the average of all pixels that are closest to it in terms of d and, therefore, have the same label as the centroid..

Thus, unlike SLIC, which requires multiple k-means iterations to update the centroids, we update the centroids in a single iteration..

So, SLIC is based on K-Means and SNIC is an improved version of SLIC. In K-Means if the similar pixels are distant from each other they are still clustered into one class let's say class0. But while implementing SNIC, I have observed that it groups a bunch of pixels together (screenshot is attached here below) and assigns different colors to each of the bunch/group of pixels.

Do these different colors indicate different classes or can two groups of pixels indicate a similar class?

Screenshot: SNIC

  • Depends on what you coded. But I guess you can easily figure it out on your own by using a synthetic image with several island of same pixels values and look at the results... Dec 29, 2022 at 14:29

1 Answer 1


I wouldn't think of the different colors as different classes, rather more like groups of pixels that the SNIC algorithm determined were similar enough to belong to the same 'superpixel'. The colors you are seeing depends on the band you are visualizing. SNIC will output the superpixel's mean of every band that you provided to it, plus a 'clusters' band that is essentially an Object ID.

Example: https://code.earthengine.google.com/fe6ca691a249d8c40e10c3350e44d218.

It would be up to you to go a step further to classify those superpixels or objects into something more meaningful.

  • SNIC clusters pixels based on intensity and proximity, right? So, can it be used to cluster the pixels based on pixel values for instance 0.1, 0.2, etc?
    – user14
    Dec 30, 2022 at 3:11

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .