Description

Computes general-purpose local texture metrics from a single-band raster using a gray-level co-occurrence matrix (GLCM) within a moving window. Output is written as a multiband raster so that large metric sets remain manageable in Python/R APIs and QGIS.

Use features to choose which metrics are emitted. Supported feature names are contrast, dissimilarity, homogeneity, asm, energy, entropy, mean, variance, and correlation. Use direction_aggregation to combine directions (mean, min, max, range) or keep each direction as separate output bands (separate).

Angles are specified in degrees using a comma-separated list from 0,45,90,135. Increasing window_size and levels generally improves stability at higher computational cost.

Function Signature

def glcm_texture(self, input: Raster, window_size: int = 7, distance: int = 1, angles: str = "0,45,90,135", features: str = "contrast,homogeneity,energy,entropy", direction_aggregation: str = "mean", levels: int = 32, symmetric: bool = True) -> Raster: ...

Example

glcm = wbe.glcm_texture(
    input=raster,
    window_size=9,
    distance=1,
    angles="0,45,90,135",
    features="contrast,homogeneity,entropy",
    direction_aggregation="mean",
    levels=32,
    output="glcm_texture.tif",
)

See Also

image_segmentation, object_features_texture_glcm_basic

Project Links

WbW Homepage User Manual Learn More