How to determine the offset of an image to use when using the glcm feature extraction
3 views (last 30 days)
Show older comments
Hi, pls i'm working on feature extraction of an image with glcm. i have read through the internet and got the functions to do this, but i observe what they call 'offset' in which we include when we want to find multiple glcm of the input image. Please can someone explain more what this offset mean, how to specify or get the offset value to use.
i've seen people use different offset values
1)
- offsets0 = [zeros(40,1) (1:40)']
- glcms = graycomatrix(circuitBoard,'Offset',offsets0)
2) glcm = graycomatrix(I,'Offset',[2 0;0 2])
3) GLCM2 = graycomatrix(I,'offset',[2 0;0 2;0 1;1 0]);
what offset value should i use in my code...am new to matlab
0 Comments
Answers (1)
Hari
on 24 Feb 2025
Hi Precious,
I understand that you are working on feature extraction using the Gray-Level Co-occurrence Matrix (GLCM) and want to know what the ‘offset’ parameter means and how to determine appropriate offset values for your analysis.
I assume you are analyzing texture features from an image and want to understand how different offsets can capture different spatial relationships between pixel values.
Understand the Concept of Offset:
The ‘offset’ defines the spatial relationship between pixel pairs for which the GLCM is calculated. It is specified as a two-element vector [row_offset, col_offset], indicating the relative position of the second pixel with respect to the first.
Choose Offset Values Based on Texture Directionality:
Common offsets include [0 1] (horizontal), [-1 1] (diagonal), [-1 0] (vertical), and [-1 -1] (anti-diagonal). These capture different directional textures in the image.
offsets = [0 1; -1 1; -1 0; -1 -1];
Specify Multiple Offsets for Comprehensive Analysis:
You can specify multiple offsets to capture texture in various directions. This results in multiple GLCMs, each representing different spatial relationships.
glcms = graycomatrix(I, 'Offset', offsets);
Example Explanation:
For an image, using offsets like [2 0] and [0 2] would analyze relationships between pixels two units apart horizontally and vertically, respectively. This can be useful for capturing coarser textures.
Experiment with Different Offsets:
Depending on your image and analysis goals, experiment with different offsets to see which best captures the texture features you’re interested in. The choice of offset can affect the resulting texture features significantly.
Refer to the documentation of “graycomatrix” function to know more about its usage: https://www.mathworks.com/help/images/ref/graycomatrix.html
Hope this helps!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!