|
- close all;clear all;clc;
- G = cell(5,8);
- for s = 1:5
- for j = 1:8
- G{s,j}=zeros(32,32);
- end
- end
- for s = 1:5
- for j = 1:8
- G{s,9-j} = gabor([32 32],(s-1),j-1,pi,sqrt(2),pi);
- end
- end
- figure;
- for s = 1:5
- for j = 1:8
- subplot(5,8,(s-1)*8+j);
- imshow(real(G{s,j}),[]);
- end
- end
- for s = 1:5
- for j = 1:8
- G{s,j}=fft2(G{s,j});
- end
- end
- save gabor G
- function Psi = gabor (w,nu,mu,Kmax,f,sig)
- % w : Window [128 128]
- % nu : Scale [0 ...4];
- % mu : Orientation [0...7]
- % kmax = pi/2
- % f = sqrt(2)
- % sig = 2*pi
- m = w(1);
- n = w(2);
- K = Kmax/f^nu * exp(i*mu*pi/8);
- Kreal = real(K);
- Kimag = imag(K);
- NK = Kreal^2+Kimag^2;
- Psi = zeros(m,n);
- for x = 1:m
- for y = 1:n
- Z = [x-m/2;y-n/2];
- Psi(x,y) = (sig^(-2))*exp((-.5)*NK*(Z(1)^2+Z(2)^2)/(sig^2))*...
- (exp(i*[Kreal Kimag]*Z)-exp(-(sig^2)/2));
- end
- end
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|