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.
Glossary
Gray-Level Co-occurrence Matrix (GLCM)

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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
| Feature | GLCM | GLRLM | GLSZM | NGTDM |
|---|---|---|---|---|
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 |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
GLCM is one of several second-order statistical matrices used to quantify spatial relationships in medical imaging. These related concepts form the core toolkit for radiomic feature extraction.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us