gpt4 book ai didi

matlab - 将 gabor 过滤器应用于图像

转载 作者:太空宇宙 更新时间:2023-11-03 20:35:29 24 4
gpt4 key购买 nike

我是图像处理的新手。我想知道如何在具有 12 个不同方向(例如 0、15、30、45 到 165)的图像上应用 gabor 滤波器。我想将此 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');

我的输入图像是 enter image description here

我的输出图像是 enter image description here

我如何通过应用 gabor 过滤器将我的图像定位在 12 个不同的方向

我应该得到视网膜图像的输出,但我得到的输出图像是

enter image description here

最佳答案

你应该添加这两行:

...
% gb is the n-th gabor filter
img_out(:,:,n) = imfilter(img_in, gb, 'symmetric');
figure;
imshow(img_out(:,:,n));
...

关于matlab - 将 gabor 过滤器应用于图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19809156/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com