views:

84

answers:

0

I have the following gabor filter to extract image texture feature..

a=imread('image0001.jpg');
a=double(a); 
a=a-mean(a(:)); 
[r,c,l]=size(a); 

 K=5;  S=6;
 Uh=0.4;
 Ul=0.05;
 alpha=(Uh/Ul)^(1/(S-1));  
 sigmau=(alpha-1)*Uh/((alpha+1)*sqrt(2*log(2))); 
 sigmav=tan(pi/(2*K))*(Uh-2*log(2)*((sigmau^2)/Uh))/sqrt((2*log(2))-(((2*log(2))^2)*(sigmau^2)/(Uh^2)));
 sigmax=1/(2*pi*sigmau);
 sigmay=1/(2*pi*sigmav);
 b=fft2(a);
 [e d]=size(b);
  i=1;
 G=zeros(r,c,S*K);
 IZ=zeros(r,c,S*K);
for m=0:S-1
    for n=0:K-1 
       fprintf(1,'.');
       for x=-r/2+1:r/2;
          for y=-c/2+1:c/2;
             xdash=(alpha^(-m))*((x)*cos(n*pi/K)+(y)*sin(n*pi/K));
             ydash=(alpha^(-m))*((y)*cos(n*pi/K)-(x)*sin(n*pi/K));
             g(r/2+x,r/2+y)=(alpha^(-m))*((1/(2*pi*sigmax*sigmay))*exp(-0.5*(((xdash^2)/(sigmax^2))+((ydash^2)/(sigmay^2)))+0.8i*pi*xdash));
          end
       end
       [rr cc]=size(g); 
       G(:,:,i)=g;
       h=fft2(g); 
       z=b.*h;
       iz=ifft2(z);
       IZ(:,:,i)=iz;
       FeatureVector(i)=mean(abs(iz(:)));
       i=i+1;
    end
 end
 fprintf(1,'\n');

%%%%%%%%%

When I run this code I get this Error:

Error using ==> times Matrix dimensions must agree. Error in ==> ComputeGaborFeatures4 at 37 z=b.*h;

Please if any one can help me to solve this error or any one can give me another simple gabor filter?