Inferensys

Glossary

Gray-Level Co-occurrence Matrix (GLCM)

A second-order statistical method that quantifies image texture by calculating how often pairs of pixels with specific values occur in a defined spatial relationship.
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 that quantifies image texture by calculating how often pairs of pixels with specific values occur in a defined spatial relationship.

A Gray-Level Co-occurrence Matrix (GLCM) is a tabular representation of the spatial dependencies between pixel intensities in an image. It functions by counting the frequency of co-occurrence for two specific gray levels, i and j, separated by a defined distance d and angle θ. This transforms raw pixel data into a probability matrix that captures the structural arrangement of textures, distinguishing fine from coarse patterns.

From the constructed GLCM, Haralick texture features—including contrast, homogeneity, energy, and correlation—are mathematically derived. In radiomics, these features serve as quantitative imaging biomarkers, converting qualitative visual assessments of tissue heterogeneity into reproducible, mineable data for predictive modeling and clinical decision support.

SECOND-ORDER TEXTURE QUANTIFICATION

Key Characteristics of GLCM Analysis

The Gray-Level Co-occurrence Matrix (GLCM) captures the spatial interdependence of pixel intensities, forming the foundation for Haralick texture features used in radiomic tumor characterization.

01

Spatial Relationship Definition

GLCM analysis is parameterized by a specific offset vector defining the distance (d) and direction (θ) between pixel pairs. Common orientations include 0°, 45°, 90°, and 135°. A matrix is computed by counting how often a pixel with gray-level i occurs adjacent to a pixel with gray-level j at the specified offset. To achieve rotational invariance, features are often calculated for multiple directions and then averaged.

02

Haralick Texture Features

From the normalized GLCM, a suite of 14 statistical measures—originally proposed by Haralick et al. (1973)—quantifies distinct textural properties:

  • Contrast: Measures local intensity variation; high values indicate large differences between neighboring pixels.
  • Correlation: Quantifies the linear dependency of gray levels on those of neighboring pixels.
  • Energy (Angular Second Moment): Measures textural uniformity; high energy implies a repetitive pattern.
  • Homogeneity (Inverse Difference Moment): Weights values close to the diagonal heavily, indicating local similarity.
03

Intensity Discretization Dependency

The GLCM dimensions equal the number of discrete gray levels. Intensity discretization—typically using a fixed bin number (e.g., 64 or 128 bins)—is a critical pre-processing step. Using too few bins merges distinct textures, while too many bins creates a sparse, noisy matrix. The Image Biomarker Standardisation Initiative (IBSI) provides strict guidelines on bin width to ensure cross-study reproducibility.

04

Aggregation Strategies

To produce a single, directionally-invariant value for a Volume of Interest (VOI), GLCM features must be aggregated. Common strategies include:

  • 2D Slice-wise Averaging: Features are computed per slice and averaged across the volume.
  • 3D Full-Volume Merging: A single GLCM is constructed by counting co-occurrences across all 26-connected neighbors in the 3D volume.
  • Directional Averaging: The four 2D directional matrices are summed or averaged before feature calculation to suppress directional bias.
05

Clinical Radiomic Applications

GLCM-derived homogeneity and entropy are established imaging biomarkers in oncology. High entropy values often correlate with intratumoral heterogeneity, a known indicator of poor prognosis and treatment resistance. In non-small cell lung cancer (NSCLC), GLCM features have been successfully used to predict histologic subtypes and epidermal growth factor receptor (EGFR) mutation status from CT scans.

06

Symmetry and Normalization

The raw GLCM is typically asymmetric, distinguishing between the (i,j) and (j,i) transitions. To simplify analysis, the matrix is often symmetrized by adding its transpose (GLCM + GLCMᵀ). Subsequently, normalization divides every element by the total sum, converting counts into joint probability estimates. This normalized, symmetric matrix forms the basis for all standard Haralick feature calculations.

GLCM TEXTURE ANALYSIS

Frequently Asked Questions

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

A Gray-Level Co-occurrence Matrix (GLCM) is a second-order statistical method that quantifies image texture by tabulating how frequently pairs of pixels with specific intensity values occur in a defined spatial relationship. The matrix is constructed by scanning an image and counting the number of times a pixel with gray-level i occurs adjacent to a pixel with gray-level j, given a specific offset defined by a distance d and an angle θ (typically 0°, 45°, 90°, or 135°). The resulting matrix is an N x N square array, where N is the number of discrete gray levels. Unlike first-order statistics which only describe the histogram of individual pixel intensities, the GLCM captures the spatial dependencies that define visual texture patterns such as coarseness, contrast, and directionality.

COMPARATIVE ANALYSIS

GLCM vs. Other Texture Matrices

A systematic comparison of second-order and higher-order statistical texture matrices used in radiomic feature extraction, highlighting their computational mechanisms, directional dependence, and clinical applications.

FeatureGLCMGLRLMGLSZMNGTDM

Statistical Order

Second-order

Second-order

Higher-order

Second-order

Primary Mechanism

Pixel pair co-occurrence probability

Consecutive pixel run-length counts

Connected region size quantification

Neighborhood intensity difference averaging

Directional Dependence

Rotationally Invariant

Captures Coarseness

Captures Local Homogeneity

Typical Feature Count

22-26

16-18

16-18

5-7

Computational Complexity

Moderate

Moderate

High

Low

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.