我对图像处理非常陌生,我想知道如何在具有12个不同方向的图像上应用gabor滤波器,例如0、15、30、45到165.我想将此gabor滤波器应用于12个方向和输出每个方向都必须显示。我的输入是视网膜图像,方向的输出应该是在应用gabor滤镜后微调的视网膜图像。我该怎么办?
%code for gabor filter
I = getimage();
I=I(:,:,2);
lambda = 8;
theta = 0;
psi = [0 pi/2];
gamma = 0.5;
bw = 1;
N = 12;
img_in = im2double(I);
%img_in(:,:,2:3) = []; % discard redundant channels, it's gray anyway
img_out = zeros(size(img_in,1), size(img_in,2), N);
for n=1:N
gb = gabor_fn(bw,gamma,psi(1),lambda,theta)...
+ 1i * gabor_fn(bw,gamma,psi(2),lambda,theta);
% gb is the n-th gabor filter
img_out(:,:,n) = imfilter(img_in, gb, 'symmetric');
% filter output to the n-th channel
%theta = theta + 2*pi/N;
theta = 15 * n; % i wrote this because my angles are multiples of 15
% next orientation
end
figure(1);
imshow(img_in);
title('input image');
figure(2);
img_out_disp = sum(abs(img_out).^2, 3).^0.5;
%default superposition method, L2-norm
img_out_disp = img_out_disp./max(img_out_disp(:));
% normalize
imshow(img_out_disp);
title('gabor output, L-2 super-imposed, normalized');
我的输入图片是
我的输出图像是
如何通过应用gabor滤镜将图像朝向12个不同方向
我应该得到视网膜图像的输出,但是我得到的输出图像是
您应该添加以下两行:
...
% gb is the n-th gabor filter
img_out(:,:,n) = imfilter(img_in, gb, 'symmetric');
figure;
imshow(img_out(:,:,n));
...
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句