xrspatial.glcm.glcm_texture#
- xrspatial.glcm.glcm_texture(agg, metric='contrast', window_size=7, levels=64, distance=1, angle=None)[source]#
Compute GLCM texture metrics over a sliding window.
- Parameters:
agg (xr.DataArray) – 2-D input raster with numeric dtype.
metric (str or list of str) – One or more of: ‘contrast’, ‘dissimilarity’, ‘homogeneity’, ‘energy’, ‘correlation’, ‘entropy’.
window_size (int) – Side length of the sliding window. Must be odd, >= 3, and <= min(rows, cols) of the input raster.
levels (int) – Number of gray levels for quantization (2-256).
distance (int) – Pixel pair distance. Must be >= 1 and <= window_size // 2 so both pixels of a pair can fit inside the window.
angle (int or None) – Co-occurrence angle in degrees: 0, 45, 90, or 135. If None, averages over all four angles.
- Returns:
If a single metric is requested, returns a 2-D DataArray. If multiple metrics are requested, returns a 3-D DataArray with a leading ‘metric’ dimension.
- Return type:
xr.DataArray