calculation of GLCM Mean

조회 수: 5 (최근 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개)

Community Treasure Hunt

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

Start Hunting!

Translated by