-1
$\begingroup$

I am working in the filed of digital image processing. Recently I read a paper that plots Grey Level Co-occurrence Matrix (GLCM) of an image for some processing. As it is shown in following Figure this figure I am trying to plot GLCM in MATLAB using the graycoprops function but not getting expected results.

I am using the following MATLAB code.

img = imread('lena.bmp');
if(size(img, 3) == 3)
    img = rgb2gray(img);
end

subplot(1,2,1), imshow(img);
subplot(1,2,1), plot(graycoprops(img));

Kindly tell me that how can I plot GLCM as it is shown in the Figure.

$\endgroup$

closed as off-topic by A_A, MBaz, Matt L., jojek Mar 8 '17 at 11:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about signal processing within the scope defined in the help center." – A_A, MBaz, Matt L., jojek
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I am struggling to see the difficulty that seems to have motivated this question, after reviewing MATLAB's help pages on the matter. You are trying to plot a structure, when you should be looking at the output of graycomatrix $\endgroup$ – A_A Mar 7 '17 at 15:22
  • $\begingroup$ this structure is used to plot the values. It contains four variables that contains few information about the image. I am unable to get the results as it is shown in the paper using the GLCM, $\endgroup$ – Mayank Tiwari Mar 7 '17 at 15:55
1
$\begingroup$

As pointed out by A_A, you need to use the graycomatrix function to get the GLCM:

img = imread('http://www.ux.uis.no/~karlsk/ICTools/lena.bmp');
if(size(img, 3) == 3)
    img = rgb2gray(img);
end

subplot(1,2,1), imshow(img);
X = graycomatrix(img, 'NumLevels', 256, 'Symmetric', true);
I = log10(X); I(I==-inf)=nan;
subplot(1,2,2), pcolor(I); shading flat; colormap hsv; axis equal;

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.