The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: GLCM texture image
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Lee ZY

Posts: 26
Registered: 9/1/10
GLCM texture image
Posted: Jan 16, 2013 10:25 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I would like to generate a texture image based on GLCM Inverse Difference Moment. After going through this site ''. If I am not wrong, it's found that we need to create a sliding window and generate the texture value(s) on each window, which then form a texture image. and below shows the code i did, which i am not sure if i'm doing it right. Could you guys please advise me on this?

[imageHeight, imageWidth]=size(image);
windowWidth = 3;
windowHeight = 3;

for i = 1:imageHeight - windowHeight + 1
for j = 1:imageWidth - windowWidth + 1

% Compute the normalized GLCM in each window as illustrated in '

window = image(i:i + windowHeight - 1, j:j + windowWidth - 1, :);

glcm1 = graycomatrix(window,'NumLevels',Num,'G',[]) ;
M=symm/sumEle ; %normalization

% operations within window
for a=1:Num
for b=1:Num
IDM(a,b) = M(a,b)/(1+(a-b)^2) ; % Inverse Difference Moment

IDM = sum(IDM(:));

% replace IDM to the center of the window and save it as image2
image2(i+1,j+1)=IDM ;

CroppedInverseDiffImage=image2(2:x,2:y); % crop the vacant pixels

The result does not look 'good', wondering if there's any mistake i made. Thank you very much in advance.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.