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.
Usage | Returns |
---|---|
ee.Algorithms.Image.Segmentation.SNIC(image, size, compactness, connectivity, neighborhoodSize, seeds) | Image |
Argument | Type | Details |
---|---|---|
image | Image | The input image for clustering. |
size | Integer, default: 5 | The superpixel seed location spacing, in pixels. If 'seeds' image is provided, no grid is produced. |
compactness | Float, default: 1 | Compactness factor. Larger values cause clusters to be more compact (square). Setting this to 0 disables spatial distance weighting. |
connectivity | Integer, default: 8 | Connectivity. Either 4 or 8. |
neighborhoodSize | Integer, default: null | Tile neighborhood size (to avoid tile boundary artifacts). Defaults to 2 * size. |
seeds | Image, 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!