Search code examples
texturesdimensionglcm

Compute GLCM texture feature in matlab


I want to extract GLCM texture feature from an image in my CBIR system.... I applied the following code:

S=imread('A1.jpg');  
S=rgb2gray(S);  
I= imresize (S, [350 350]);     

glcm45=graycomatrix(I,'offset',[-1 1],'NumLevel', 8,'Symmetric',true); 
                                                         % 45 engle degree  
glcm135 = graycomatrix(I,'Offset',[-1 -1],'NumLevel', 8,'Symmetric',   true );  % 135 engle degree

GLCM=glcm45+glcm135;

I get 64(8*8) dimensions for GLCM feature and I used it in retrieve the similarity images and I get a very good results....

My question is: Can I consider this 64 dimensions as the length of GLCM feature vector for an image?


Solution

  • Yes you can consider it as a feature. There's even a research article on this --- using GLCMs as sole features for doing face detection: "Co-occurence Matrix and its Statistical Features as a New Approach for Face Recognition". Here's the link.

    That paper also shows that using GLCMs as features performs better than the Haralick features derived from the GLCMs. Also, GLCMs can be computed within milliseconds (0.5ms - 2ms; my own implementation in C++, 256x256 GLCMs with all 0, 45, 90 and 135 degree neighbourhood correspondences), and so it is a cheap and an excellent feature.