www.pudn.com > GaitRecognition.rar > GaborFilter.m, change:2012-10-30,size:976b


% function [G,gabout] = GaborFilter(I,Sx,Sy,U,V) 
%  
% if isa(I,'double')~=1  
%     I = double(I); 
% end 
%  
% for x = -fix(Sx):fix(Sx) 
%     for y = -fix(Sy):fix(Sy) 
%         G(fix(Sx)+x+1,fix(Sy)+y+1) = (1/(2*pi*Sx*Sy))*exp(-.5*((x/Sx)^2+(y/Sy)^2)+2*pi*i*(U*x+V*y)); 
%     end 
% end 
%  
% Imgabout = conv2(I,double(imag(G)),'same'); 
% Regabout = conv2(I,double(real(G)),'same'); 
%  
% gabout = uint8(sqrt(Imgabout.*Imgabout + Regabout.*Regabout)); 
 
function [filtedImage]=GaborFilter(I,u,v) 
 if isa(I,'double')~=1  
     I = double(I); 
 end 
delta_square=(2*pi)^2;% detaƽ 
%sita=pi/(2*sqrt(2)^u); 
%fai=pi*v/8; 
%r=sita*exp(i*fai); 
r=pi*exp(i*pi*v/8)/(2*sqrt(2)^u) 
norm_r=norm(r); 
heigh_I=size(I,1); 
length_I=size(I,2); 
filtedImage=zeros(heigh_I,length_I); 
for x=1:heigh_I 
    for y=1:length_I 
        filtedImage(x,y)=(norm_r/delta_square)*exp(norm_r*norm(I(x,y))/(-2*delta_square))*(exp(i*r*I(x,y))-exp(delta_square/(-2))); 
    end 
end