gaborfilter.m

来自「The matlab program is effective to be us」· M 代码 · 共 30 行

M
30
字号
%upload on 26-05-09. To contact author, Dr Wang Jun, please drop you
%message at wangjun5100@hotmail.com 

function[h]=gaborfilter(U,V)

F=sqrt(U^2+V^2);
A=atan2(V,U);

a=sqrt(log(2)/2);
j=sqrt(-1);
Q=36.8699*pi/180; % orientation bandwidth 37 degree corresponding to B=1.0 ocatave
std=a/(tan(Q/2)*pi*F);

%std=1/F;

bandwidth=fix(3*std);% define the bandwidth of the Gabor filter in the fourier domain
g = fspecial('gaussian',2*bandwidth+1,std);

for k=-bandwidth:bandwidth,
   e1(k+bandwidth+1)=exp(j*2*pi*(U*k));% vertical fringes
   e2(k+bandwidth+1)=exp(-j*2*pi*(V*k));% horizontal fringes % note the rotation direction is clockwise
end

for k=-bandwidth:bandwidth,
   h1(k+bandwidth+1,:)=e1;
   h2(:,k+bandwidth+1)=e2';
end

h=h2.*g.*h1;
return;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?