what is meant by GLCM MEAN (average) ?

i want to know the meaning of GLCM MEAN..
how can i calculate it in matlab?
what is the syntax?
reply soon

 Akzeptierte Antwort

Youssef  Khmou
Youssef Khmou am 23 Feb. 2013

1 Stimme

GLCM stand for : Grey-Level Co-occurrence Matrix ,
More info/examples can be found in the following URL :

1 Kommentar

REHAN AHMAD
REHAN AHMAD am 28 Mär. 2020
how to calculate GLCM feature correlationmatlab

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Image Analyst
Image Analyst am 23 Feb. 2013

0 Stimmen

It's the Gray Level Co-occurrence Matrix. It basically is kind of like a histogram of how many times a certain gray level occurs next to other gray levels in an image. Sometimes used in texture analysis. It is performed by the function graycomatrix() in the Image Processing Toolbox.

6 Kommentare

thanks for sharing, so an example :
G=graycomatrix(imread('liftingbody.png'));
it gives 8x8 matrix , so why exactly 8x8?
angel
angel am 23 Feb. 2013
Bearbeitet: angel am 23 Feb. 2013
ok sir... i know glcm is caculated as
glcm=graycomatrix(image);
i've divided the image into non overlapping blocks...the code is like this...
blockSizeR = 32;% Rows in block.
blockSizeC = 32; % Columns in block.
% Figure out the size of each block.
wholeBlockRows = floor(rows / blockSizeR);
wholeBlockCols = floor(columns / blockSizeC);
fprintf('\nSize of whole block is %d x %d\n\n',wholeBlockRows,wholeBlockCols);
% Now scan though, getting each block and putting it as a slice of a 3D array.
blockNumber = 1;
for row = 1 : blockSizeR : rows
for col = 1 : blockSizeC : columns
row1 = row;
row2 = row1 + blockSizeR - 1;
row2 = min(rows, row2);
% Determine starting and ending columns.
col1 = col;
col2 = col1 + blockSizeC - 1;
col2 = min(columns, col2); % Don't let it go outside the image.
% Extract out the block into a single subimage.
oneBlock = grayImage(row1:row2, col1:col2);
subplot(8,8,blockNumber);
imshow(oneBlock);
caption = sprintf('Block #%d\n of 64', blockNumber);
title(caption, 'FontSize', fontSize);
blockNumber = blockNumber + 1;
end
end
figure,imshow(grayImage, []);
title('original image');
sir plz can u tell me by writing a piece of code to calculate the GLCM MEAN..
Raman
Raman am 23 Feb. 2013
@Youssef KHMOU sir as i m working on my project...m not decided yet exactly what should it be(block size)...i keep on changing it so that i can recognize what it be exactly....
for the timing u can take it as 8x8...
m working on copy move forgery detection...
ur help means alot to me..
Youssef  Khmou
Youssef Khmou am 23 Feb. 2013
ok thanks..
Image Analyst
Image Analyst am 23 Feb. 2013
Youssef, it's 8 by 8 because they chose to do so. I think intuitively you were expecting 256 by 256, right? That's what I would expect. But for whatever reason, they decided to make an 8 by 8 so the first row or column counts any pixel in the range 0-31 that is next to any other pixel with gray level 0-31, and so on.
Youssef  Khmou
Youssef Khmou am 23 Feb. 2013
Bearbeitet: Youssef Khmou am 23 Feb. 2013
Mr "Image Analyst": yes,as it is "comatrix" of M(m,n) "refers/related" to either covariance (cross correlation) , or simple meaning of Comtarix, size expected was n-by-n or m-by-m .
But this approach makes sens , unless one is concerned about very tiny details of individual pixels, then he can write a code suitable for that . ok thanks for the explanation

Melden Sie sich an, um zu kommentieren.

Youssef  Khmou
Youssef Khmou am 23 Feb. 2013

0 Stimmen

so you have two means : left hand side and right hand side ( reference : the link above ), lets take an example :
I=imread('liftingbody.png');
G=graycomatrix(I);
[m n]=size(G);
GLCMl=0 % left
GLCMr=0; % right
for x=1:m
for y=1:n
GLCMl=GLCMl+x*G(x,y);
GLCMr=GLCMr+y*G(x,y);
end
end
it will give 1277276 and 1277165 , logical answer ?

3 Kommentare

angel
angel am 23 Feb. 2013
Bearbeitet: angel am 23 Feb. 2013
left and right hand side means???
u mean in two directions row wise and column wise right??? sir
tell me if i m correct or not?
Youssef  Khmou
Youssef Khmou am 23 Feb. 2013
everyrthing is in the link angel :
i quote : " The left hand equation calculates the mean based on the reference pixels, i. It is also possible to calculate the mean using the neighbour pixels, j, as in the right hand equation. For the symmetrical GLCM, where each pixel in the window is counted once as a reference and once as a neighbour, the two values are identical."
angel
angel am 23 Feb. 2013
thank u so much...
ur help means alot to me...
:)

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 20 Feb. 2013

Kommentiert:

am 28 Mär. 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by