ee.Image.spectralGradient

Computes the spectral gradient over all bands of an image (or the first band if the image is Array typed) by computing the per-pixel difference between the spectral erosion and dilation with a given structuring kernel and distance metric. See: Plaza, Antonio, et al. 'Spatial/spectral endmember extraction by multidimensional morphological operations.' IEEE transactions on geoscience and remote sensing 40.9 (2002): 2025-2041.

UsageReturns
Image.spectralGradient(metric, kernel, useCentroid)Image
ArgumentTypeDetails
this: imageImage

The input image.

metricString, default: "sam"

The spectral distance metric to use. One of 'sam' (spectral angle mapper), 'sid' (spectral information divergence), 'sed' (squared euclidean distance), or 'emd' (earth movers distance).

kernelKernel, default: null

Connectedness kernel. Defaults to a square of radius 1 (8-way connected).

useCentroidBoolean, default: false

If true, distances are computed from the mean of all pixels under the kernel instead of the kernel's center pixel.

Examples

JavaScript

// Your example goes here!

Python

# Your example goes here!