calculation of GLCM Mean

i,ve gone through the tutorial
http://www.fp.ucalgary.ca/mhallbey/glcm_mean.htm
i've divided the image into discrete blocks.i want to calculate the GLCM Mean of every block... can u tell me by writing code of glcm Mean...
glcm=graycomatrix(input_image);
this i know...
what i dont know is the GLCM Mean.. can anybody tell me the synrtax for it?

 Akzeptierte Antwort

Youssef  Khmou
Youssef Khmou am 23 Feb. 2013
Bearbeitet: Youssef Khmou am 23 Feb. 2013

0 Stimmen

hi Jassy ,
there is an answer ( to check ...) in previous question, i repost it here anyway for further discussion/correction with other Contributers :
I=imread('liftingbody.png');
G=graycomatrix(I);
[m n]=size(G);
GLCMl=0 % left hand side mean
GLCMr=0; % right hand side mean
for x=1:m
for y=1:n
GLCMl=GLCMl+x*G(x,y);
GLCMr=GLCMr+y*G(x,y);
end
end
The difference between the two is 111.

2 Kommentare

Raman
Raman am 25 Feb. 2013
thank you sir
Raman
Raman am 27 Feb. 2013
[rows columns]=size(input_image);
glcml=0;
glcmr=0;
glcmL=[];
glcmR=[];
blockSizeR = 32;% Rows in block.
blockSizeC = 32; % Columns in block.
for row = 1 : blockSizeR : rows
for col = 1 : blockSizeC : columns
row1 = row;
row2 = row1 + blockSizeR - 1;
row2 = min(rows, row2);
col1 = col;
col2 = col1 + blockSizeC - 1;
col2 = min(columns, col2);
oneBlock = grayImage(row1:row2, col1:col2);
subplot(8,8,blockNumber);
imshow(oneBlock);
glcm=graycomatrix(oneBlock);
for x=1:wholeBlockRows
for y=1:wholeBlockCols
glcml=glcml+x*glcm(x,y);
glcmr=glcmr+y*glcm(x,y);
glcmL(blockNumber)=glcml;
caption=sprintf('\nGLCM Mean along left of #%d is %d',blockNumber,glcmL(blockNumber));
disp(caption);
glcmR(blockNumber)=glcmr;
caption1=sprintf('\nGLCM Mean along right of #%d is %d',blockNumber,glcmR(blockNumber));
disp(caption1);
blockNumber = blockNumber + 1;
end
end
here, i've divided the image into discrete blocks of 8x8. Here m calculating the GLCM MEAN of every block. can u tell me the output(GLCM Mean)it produces is correct or not corresponding to each block..as m not able to identify as it is correct or not.
i'll be very thankful to u
reply soon

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by