Objects returned by snic inherit from the snic
S3 class. They are lightweight containers bundling the segmentation
result together with per-cluster summaries produced by the SNIC
algorithm. Internally, a snic object is a named list with
components:
segThe segmentation map in the native type of the input (either a 3D integer
arraywith dimensions(height, width, 1)or a single-layerSpatRaster—matching the input given tosnic()). Values are superpixel labels (positive integers);NAmarks pixels that were not assigned.meansNumeric matrix with one row per superpixel and one column per input band (column names preserved when available), giving the mean feature value of each cluster. May be
NULLif the backend cannot retain these summaries.centroidsNumeric matrix with columns
randcgiving the cluster centers in pixel coordinates (0-based indices used by the SNIC core). May beNULLwhen centroids are unavailable.
The list carries class "snic" to enable the accessors and print
methods below; the segmentation labels index the corresponding rows of
means and centroids.
Usage
snic_get_means(x)
snic_get_centroids(x)
snic_get_seg(x)
# S3 method for class 'snic'
snic_get_means(x)
# S3 method for class 'snic'
snic_get_centroids(x)
# S3 method for class 'snic'
snic_get_seg(x)
# S3 method for class 'snic'
print(x, ...)Arguments
- x
A
snicobject, typically the result of a call tosnic. It stores the segmentation map along with per-cluster summaries (means, centroids, and metadata) produced by the SNIC algorithm.- ...
Additional arguments passed to or from methods. Currently unused, but included for compatibility with S3 method dispatch.
Value
snic_get_means(): Numeric matrix of per-cluster band means, orNULLwhen not available.snic_get_centroids(): Numeric matrix with columnsrandcgiving cluster centers in pixel coordinates (0-based), orNULLwhen not available.snic_get_seg(): Segmentation map in the native type of the input (arrayorSpatRaster) with integer labels and possibleNAfor unassigned pixels.print.snic(): Invisibly returnsxafter printing a human-readable summary.
Accessors
snic_get_seg: Retrieve the segmentation result.snic_get_means: Retrieve per-cluster feature means.snic_get_centroids: Retrieve per-cluster centroids.
Methods
snic_animation: Animate the segmentation process.print: Print a summary of the segmentation result.plot: Visualize the segmentation result.