lazyslide_models.tile_prediction.cv_features.HaralickTexture

lazyslide_models.tile_prediction.cv_features.HaralickTexture#

class HaralickTexture(distances=None, angles=None, levels=8)#

Bases: _CVFeatures

haralick_texture Haralick texture features from the gray-level co-occurrence matrix

Calculate texture features using Gray Level Co-occurrence Matrix (GLCM).

This class implements Haralick texture features which are derived from the GLCM. These features provide information about the texture of an image and are widely used in image analysis.

The co-occurrence matrices of all offsets, each counting only pixel pairs inside the tile, are averaged before the features are computed. As in scikit-image’s graycoprops, texture_energy is the angular second moment (its "ASM"; its "energy" is the square root). Correlation is 0 on a flat tile, where it is undefined.

The tile can be in shape (H, W, C) for a single image or (B, C, H, W) for a batch of images.

Parameters:
distanceslist of int

List of pixel pair distance offsets.

angleslist of float

List of pixel pair angles in radians.

levelsint

Number of gray levels to use in the GLCM, from 2 to 256.

columns = ('texture_energy', 'texture_contrast', 'texture_homogeneity', 'texture_correlation', 'texture_entropy')#

Subclasses whose _func returns a dict set this explicitly; for the rest it is derived below from the class name, which is the same rule _process_batch uses to key its result.