I am having the program for gabor filter with 3 scales and 4 orientation hence there will be 12 gabor filtered images.i have shown the pgm below..can anyone he to take the 12 filtered images as output...

1 Ansicht (letzte 30 Tage)
function G=gabor(X1)
M=4; N=3; a=(0.4 / 0.05)^(1/(M-1)); gab=cell(2,2); count=1;
for m=1:M
for n=1:N
W=a^m * 0.05;
sigmax=((a+1)*sqrt(2 * log(2))) / (2 * pi * a^m * (a-1) * 0.05);
sigmay1=((0.4 *0.4) / (2*log(2))) - (( 1 / (2 *pi* sigmax))^2);
sigmay=1 / ((2* pi * tan(pi/(2*N)) * sqrt ( sigmay1)));
theta=(n*pi)/N ;
for ij=1:2
for i=1:3
for j=1:3
xb=a^(-m) * (i*cos(theta) + j*sin(theta));
yb=a^(-m) * ((-i)*sin(theta) + j*cos(theta));
phi1=(-1/2) * ((xb*xb)/(sigmax*sigmax) + (yb*yb)/(sigmay*sigmay));
if ij==1
prob=i;
else
prob=j;
end
phi=(1/(2*pi*sigmax*sigmay)) * exp(phi1) *exp(2*pi*W*prob);
gab1(i,j)=phi* a^(-m);
end
end
gab{count,ij}=gab1;
end
count=count+1;
end
end
mskno=1;
for i=1:12 for j=1:2 aa=cell2mat(gab(i,j)); aa=double(aa); mask(:,:,mskno)=aa; mskno = mskno+1; end
end
for k=1:24
filterimage(:,:,k)=conv2(X1,mask(k),'same');
end
G=filterimage;
  1 Kommentar
Thorsten
Thorsten am 9 Jan. 2013
I think it does not make much sense to define a Gabor on a 3 x 3 grid because you get a very coarse approximation of a Gabor. If you filter your image with these "Gabors" you may get some unexpected results.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by