ee.Algorithms.Image.Segmentation.SNIC

Superpixel clustering based on SNIC (Simple Non-Iterative Clustering). Outputs a band of cluster IDs and the per-cluster averages for each of the input bands. If the 'seeds' image isn't provided as input, the output will include a 'seeds' band containing the generated seed locations. See: Achanta, Radhakrishna and Susstrunk, Sabine, 'Superpixels and Polygons using Simple Non-Iterative Clustering', CVPR, 2017.

UsageReturns
ee.Algorithms.Image.Segmentation.SNIC(image, size, compactness, connectivity, neighborhoodSize, seeds)Image
ArgumentTypeDetails
imageImage

The input image for clustering.

sizeInteger, default: 5

The superpixel seed location spacing, in pixels. If 'seeds' image is provided, no grid is produced.

compactnessFloat, default: 1

Compactness factor. Larger values cause clusters to be more compact (square). Setting this to 0 disables spatial distance weighting.

connectivityInteger, default: 8

Connectivity. Either 4 or 8.

neighborhoodSizeInteger, default: null

Tile neighborhood size (to avoid tile boundary artifacts). Defaults to 2 * size.

seedsImage, default: null

If provided, any non-zero valued pixels are used as seed locations. Pixels that touch (as specified by 'connectivity') are considered to belong to the same cluster.

Examples

JavaScript

// Your example goes here!

Python

# Your example goes here!