Inferensys

Glossary

Gray-Level Co-occurrence Matrix (GLCM)

A second-order statistical method that quantifies texture by calculating the frequency of specific pairs of pixel intensities occurring at a defined spatial offset.
Isolated secure server room with network cables physically disconnected, minimal lighting, security-focused environment.
SECOND-ORDER TEXTURE ANALYSIS

What is Gray-Level Co-occurrence Matrix (GLCM)?

A Gray-Level Co-occurrence Matrix (GLCM) is a second-order statistical method for texture analysis that quantifies the spatial relationship between pixel pairs by calculating the frequency of specific intensity combinations occurring at a defined distance and angular offset.

The Gray-Level Co-occurrence Matrix (GLCM), also known as the gray-tone spatial-dependence matrix, characterizes image texture by tabulating how often pairs of pixels with specific values and in a specified spatial relationship occur in an image. Unlike first-order statistics that ignore spatial context, GLCM captures the second-order joint conditional probability density function of pixel intensities. The matrix is constructed by defining a displacement vector d (distance) and an angle θ (typically 0°, 45°, 90°, or 135°), then counting co-occurrences of gray levels i and j at that offset.

From the constructed matrix, Haralick et al. defined 14 statistical features that quantify textural properties such as homogeneity, contrast, and entropy. Key derived metrics include contrast (measuring local intensity variation), energy (also called Angular Second Moment, quantifying textural uniformity), correlation (linear dependency of gray levels), and homogeneity (closeness of element distribution to the diagonal). In radiomics, GLCM features are computed after intensity discretization to reduce the number of gray levels, and are often averaged across multiple angular directions to achieve rotational invariance, providing robust quantitative descriptors of tissue heterogeneity in medical images.

TEXTURE ANALYSIS METRICS

Core GLCM-Derived Haralick Features

The Gray-Level Co-occurrence Matrix (GLCM) quantifies texture by tabulating how often pairs of pixel intensities occur at a defined spatial offset. From this matrix, Robert Haralick proposed 14 statistical measures that describe image texture characteristics such as homogeneity, contrast, and complexity.

01

Angular Second Moment (ASM) & Energy

Measures textural uniformity—the sum of squared GLCM entries.

  • High ASM: Image has constant or periodic pixel patterns (few dominant gray-tone transitions)
  • Low ASM: Pixel intensities are randomly distributed across the matrix
  • Energy is the square root of ASM, providing a more linear scaling
  • Clinical relevance: Homogeneous tumors often exhibit higher ASM values, correlating with less aggressive phenotypes in certain cancers
  • Formula: ASM = Σᵢⱼ p(i,j)² where p(i,j) is the normalized co-occurrence probability
02

Contrast

Quantifies the local intensity variation and the depth of texture grooves.

  • High contrast: Large differences between neighboring pixel intensities (sharp edges, noise)
  • Low contrast: Smooth, visually flat regions with minimal intensity variation
  • Weighted by distance: Squared difference (i-j)² amplifies contributions from far-apart gray levels
  • Clinical relevance: Malignant lesions often show higher contrast due to heterogeneous internal architecture
  • Related term: Inertia—identical mathematical formulation, emphasizing resistance to intensity change
03

Correlation

Measures the linear dependency of gray levels on those of neighboring pixels.

  • Range: -1 to +1, where +1 indicates perfect positive linear relationship
  • High correlation: Predictable, structured texture with directional patterns
  • Low correlation: Uncorrelated, chaotic pixel arrangements
  • Directionally sensitive: Values change based on the spatial offset angle (0°, 45°, 90°, 135°)
  • Clinical relevance: Quantifies tissue anisotropy—fibrotic tissue shows directional correlation patterns distinct from normal parenchyma
04

Homogeneity (Inverse Difference Moment)

Weighs the closeness of GLCM elements to the diagonal, indicating local similarity.

  • High homogeneity: Matrix elements cluster near the diagonal—adjacent pixels have similar intensities
  • Low homogeneity: Wide distribution of intensity pairs, indicating rough texture
  • Inverse weighting: 1/(1+(i-j)²) gives higher weight to small intensity differences
  • Clinical relevance: Benign masses often demonstrate greater internal homogeneity than malignant counterparts
  • Related metric: Inverse Difference Normalized (IDN) removes dependence on total number of gray levels
05

Entropy

Measures the randomness and information content of the texture pattern.

  • High entropy: Broad distribution of co-occurrence probabilities—complex, unstructured texture
  • Low entropy: Concentrated probabilities—simple, repetitive patterns
  • Theoretical basis: Derived from information theory; -Σ p(i,j) × log(p(i,j))
  • Clinical relevance: High entropy in tumor ROIs often indicates necrosis, hemorrhage, or aggressive growth patterns
  • Distinction: GLCM entropy captures spatial disorder, unlike first-order entropy which ignores pixel relationships
06

Cluster Shade & Cluster Prominence

Higher-order measures of matrix asymmetry and tailedness.

  • Cluster Shade: Measures skewness of the GLCM—positive values indicate dominance of low-intensity pairs, negative values indicate high-intensity dominance
  • Cluster Prominence: Measures kurtosis—high values indicate a peaked distribution with heavy tails (dominant clusters)
  • Clinical relevance: Cluster prominence is a key discriminator in tumor grading, with aggressive lesions showing prominent high-intensity clusters
  • Calculation: Both use cubed and fourth-power deviations from the mean, making them sensitive to outliers in the co-occurrence distribution
SECOND-ORDER VS. HIGHER-ORDER TEXTURE ANALYSIS

GLCM vs. Other Texture Matrices in Radiomics

A comparative analysis of the Gray-Level Co-occurrence Matrix against other standardized texture matrices defined by the Image Biomarker Standardisation Initiative (IBSI), highlighting spatial relationship modeling, computational complexity, and clinical utility.

FeatureGLCMGLRLMGLSZMGLDM

Statistical Order

Second-order

Higher-order

Higher-order

Higher-order

Spatial Relationship Modeled

Pairwise pixel co-occurrence at defined offset

Consecutive collinear runs of identical intensity

Connected homogeneous regions of identical intensity

Dependence of center voxel on neighborhood

Rotationally Invariant

Primary Texture Captured

Contrast, correlation, homogeneity

Roughness, linear structure

Granularity, non-linear homogeneity

Local intensity dependence

Number of IBSI Features

24

16

16

14

Computational Complexity

High

Medium

Medium

Low

Sensitivity to Discretization

High

Medium

Medium

Low

Typical Clinical Application

Lesion heterogeneity quantification

Tissue anisotropy assessment

Tumor sub-region texture

Noise-robust texture analysis

GLCM FUNDAMENTALS

Frequently Asked Questions

Clear, technical answers to the most common questions about the Gray-Level Co-occurrence Matrix and its role in radiomic texture quantification.

A Gray-Level Co-occurrence Matrix (GLCM) is a second-order statistical method that quantifies image texture by tabulating how frequently specific pairs of pixel intensity values occur at a defined spatial offset. The algorithm constructs an N×N matrix—where N equals the number of discretized gray levels—by scanning the region of interest and counting every instance where a pixel of intensity i neighbors a pixel of intensity j at a specified distance d and angle θ. This matrix captures the spatial dependency of intensities, distinguishing homogeneous textures (where similar values cluster) from heterogeneous ones (where values vary wildly). The raw co-occurrence counts are then normalized to probabilities, and Haralick texture features—such as contrast, correlation, energy, and homogeneity—are derived from these probability distributions to provide quantitative descriptors of the tissue architecture.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.