我是一个对图像处理完全陌生的人。我想知道如何在一张视网膜图像上应用12个不同方向(例如0、15、30、45至165度)的gabor滤波器。我希望能够将这12个方向的gabor滤波器应用到图像上,并显示每个方向的输出结果。我的输入是一张视网膜图像,每个方向的输出应该是经过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');
我的输入图像是
![enter image description here](https://istack.dev59.com/fyhzn.webp)
而我的输出图像是
![enter image description here](https://istack.dev59.com/bVwDw.webp)
如何通过应用Gabor滤波器将我的图像定向为12个不同的方向?
我本来应该得到一个视网膜图像的输出,但是我得到的输出图像是
![enter image description here](https://istack.dev59.com/ThWZd.webp)