calculation of GLCM Mean

4 次查看(过去 30 天)
Raman
Raman 2013-2-23
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?

采纳的回答

Youssef  Khmou
Youssef Khmou 2013-2-23
编辑:Youssef Khmou 2013-2-23
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 个评论
Raman
Raman 2013-2-25
thank you sir
Raman
Raman 2013-2-27
[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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by