Skip to content

Commit 9112fd8

Browse files
committed
Add GLCM texture metrics to focal module (#963)
New xrspatial.glcm module with glcm_texture() for computing Haralick texture features (contrast, dissimilarity, homogeneity, energy, correlation, entropy) over a sliding window. Supports numpy, dask+numpy, cupy, and dask+cupy backends. Dask path pre-quantizes globally for consistent gray-level mapping across chunks.
1 parent b66c00e commit 9112fd8

3 files changed

Lines changed: 458 additions & 0 deletions

File tree

xrspatial/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from xrspatial.flow_length import flow_length # noqa
4545
from xrspatial.flow_path import flow_path # noqa
4646
from xrspatial.focal import mean # noqa
47+
from xrspatial.glcm import glcm_texture # noqa
4748
from xrspatial.morphology import morph_closing # noqa
4849
from xrspatial.morphology import morph_dilate # noqa
4950
from xrspatial.morphology import morph_erode # noqa

xrspatial/accessor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ def focal_mean(self, **kwargs):
181181
from .focal import mean
182182
return mean(self._obj, **kwargs)
183183

184+
def glcm_texture(self, **kwargs):
185+
from .glcm import glcm_texture
186+
return glcm_texture(self._obj, **kwargs)
187+
184188
# ---- Morphological ----
185189

186190
def morph_erode(self, **kwargs):
@@ -545,6 +549,10 @@ def focal_mean(self, **kwargs):
545549
from .focal import mean
546550
return mean(self._obj, **kwargs)
547551

552+
def glcm_texture(self, **kwargs):
553+
from .glcm import glcm_texture
554+
return glcm_texture(self._obj, **kwargs)
555+
548556
# ---- Morphological ----
549557

550558
def morph_erode(self, **kwargs):

0 commit comments

Comments
 (0)