我已经实现了Gabor滤镜,但不知道如何将其与输入图像进行卷积以获得所需的结果。我的输入图像大小为240 * 320,我将其划分为17 *的块17 ..所以总共有14 * 18 = 255个块。我也不确定Gabor滤波器的大小应该是什么?我需要将每个滤波器(14 * 18 = 252个滤波器)卷积到每个块或整个图像..
这是我的代码..
% compute Gabor filter
sigma_x = 4;
sigma_y = 4;
w = 17; % size of block
wg = 5; % size of filter
Gabor = zeros(m1,n1);
for i = 9:w:240-w
for j3 = 9:w:320-w
pim = im(i-ww:i+ww,j-ww:j+ww); % block of input image
f = F(i,j); %each block contains single value
of freuency and theta
O = theta(i,j);
[x,y] = meshgrid(-floor(wg/2):floor(wg/2));
x_phi = x.*cos(O) + y.*sin(O);
y_phi = -x.*sin(O) + y.*cos(O);
x_val = ((x_phi).^2)./(sigma_x.^2);
y_val = ((y_phi).^2)./(sigma_y.^2);
h = exp(-0.5*(x_val+y_val)).*cos((2*pi*f).*(x_phi));
Gabor(i-ww:i+ww,j-ww:j+ww) = conv2(pim,h,'same');
end;
end;
输出图像是指纹,不应该是黑色指纹线上的白点。