0

I want to show the GLCMs of an image in Matlab. So far I've tried and been able to get only to the stats.

I = imread('cameraman.tif');
glcm1 = graycomatrix(I);
Stats = graycoprops(glcm1);

And it results in the stats.

Stats =

   Contrast: 0.5006
Correlation: 0.9269
     Energy: 0.1636
Homogeneity: 0.8925

What I want is to show the image of these 4 GLCMs like here.

Image It should be simple to output that image, but I'm all new to this thing and don't know what I'm missing.

Tonechas
  • 13,398
  • 16
  • 46
  • 80
Yokesh Kdk
  • 29
  • 1
  • 2
  • 8
  • `imshow(glcm1, [])`? – rayryeng Feb 17 '17 at 17:58
  • That did return a very small pixel of the Image. Don't know what that is tho. [Example Images](http://www.fp.ucalgary.ca/mhallbey/examples.htm) Follow the link and find the section "2. Various GLCM texture measures implemented". I want to process the original image to GLCM and show them like that. Contrast,Homogeneity,Entropy etc... Is it possible? – Yokesh Kdk Feb 17 '17 at 20:59

2 Answers2

0

GLCM is not Image Matrix , It is shown the pairs of pixels in matrix as shown in the next photo enter image description here

barbsan
  • 3,418
  • 11
  • 21
  • 28
Abo Lregal
  • 75
  • 8
  • [Example Images](http://www.fp.ucalgary.ca/mhallbey/examples.htm) I think GLCM can return images. Follow the link and find the section "2. Various GLCM texture measures implemented". I want to process the original image to GLCM and show them like that. Contrast,Homogeneity,Entropy etc... Is it possible? – Yokesh Kdk Feb 17 '17 at 20:52
0

You can show the gray level co-occurrence matrix of an image through imagesc:

I = imread('https://raw.github.com/antimatter15/cameraman/master/cameraman.png');
imshow(I)
M = graycomatrix(I, 'GrayLimits', [0, 255], 'NumLevels', 256, 'Offset', [0 1], 'Symmetric', true);
figure
imagesc(M)
colormap(gray)
graycoprops(M)

The displayed GLCM corresponds to an offset "one pixel to the right". This matrix is largely diagonal, which means that the pixels' intensities are highly correlated.

glcm

The features extracted from the GLCM above are as follows:

       Contrast: 518.6036
    Correlation: 0.9335
         Energy: 0.0015
    Homogeneity: 0.3772
Tonechas
  • 13,398
  • 16
  • 46
  • 80