```Date: Jan 16, 2013 10:25 PM
Author: Lee ZY
Subject: GLCM texture image

I would like to generate a texture image based on GLCM Inverse Difference Moment. After going through this site 'http://www.fp.ucalgary.ca/mhallbey/texture_calculations.htm'. 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?image=imread('circuit.tif');[imageHeight, imageWidth]=size(image);windowWidth = 3;windowHeight = 3;k2=floor(windowWidth/2); for i = 1:imageHeight - windowHeight + 1      for j = 1:imageWidth - windowWidth + 1                % Compute the normalized GLCM in each window as illustrated in 'http://www.fp.ucalgary.ca/mhallbey/ans_ex_1.htm                window = image(i:i + windowHeight - 1, j:j + windowWidth - 1, :);        wind=window(:);        Num=length(unique(wind));                        glcm1 = graycomatrix(window,'NumLevels',Num,'G',[])  ;           glcm2=glcm1';        symm=glcm1+glcm2;        sumEle=sum(symm(:));        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                 end        end               IDM = sum(IDM(:));                % replace IDM to the center of the window and save it as image2            image2(i+1,j+1)=IDM ;               endend[x,y]=size(image2);CroppedInverseDiffImage=image2(2:x,2:y);  % crop the vacant pixels figure(2),imshow(CroppedInverseDiffImage);The result does not look 'good', wondering if there's any mistake i made. Thank you very much in advance.
```