This is code for serial Gabor filters. The problem I am getting is the statement J = J + abc
should return a final filtered image as a superposition of all filters but only the result of the last iteration is displayed:
function [J] = gabor(I)
J = zeros(size(I));
for phi = 5*pi/8:pi/8:pi;
for theta = 1:0.5:2;
for filterSize = 4:6;
sigma = 0.65*theta;
G = zeros(filterSize);
for i=(0:filterSize-1)/filterSize
for j=(0:filterSize-1)/filterSize
xprime= j*cos(phi);
yprime= i*sin(phi);
K = exp(2*pi*theta*sqrt(-1)*(xprime+ yprime));
G(round((i+1)*filterSize),round((j+1)*filterSize)) = exp(-(i^2+j^2)/(sigma^2))*K;
end
end
abc = conv2(double(I),double(G),'same');
J = J + abc;
end
end
end
figure; imshow(J);
end
Here is what the output image looks like: