简体   繁体   English

叠加来自Gabor滤镜的多个图像

[英]Superimpose multiple images from Gabor filter

I'm learning about Gabor filters for the first time and how they can be used to regenerate fingerprints from their orientation maps. 我是第一次学习Gabor过滤器,以及如何将其用于从其方向图重新生成指纹。 I'm given an orientation map in the form of a .jpg and I want to apply gabor filters with 4 orientations on it. 我以.jpg的形式获得了方向图,我想在其上应用具有4个方向的gabor滤镜。 I followed the example in the documentation and ended up with the following code: 我按照文档中的示例进行操作,并得到以下代码:

input_img = imread('orientation.jpg');
input_img = rgb2gray(input_img);  

wavelength = 6;
orientation = [0 45 90 135];
gaborArray = gabor(wavelength,orientation);
gaborMag = imgaborfilt(input_img,gaborArray);

figure
subplot(2,2,1);
for p = 1:4
    subplot(2,2,p)
    imshow(gaborMag(:,:,p),[]);
    theta = gaborArray(p).Orientation;
    lambda = gaborArray(p).Wavelength;
    title(sprintf('Orientation=%d, Wavelength=%d',theta,lambda));
end

My input is: 我的输入是:

orientation.jpg

The output is: 输出为: 产量

What I really want however is a single fingerprint like the following: 但是我真正想要的是一个单一的指纹,如下所示:

fingerprint.jpg

I understand that my output is currently the way it is due to the subplot . 我知道我的输出当前是由于subplot引起的。 I tried replacing subplot with hold on and plot but what ends up happening is that the final image at Orientation=135 overlaps the others. 我尝试用hold onplot替换subplot ,但是最终发生的是在Orientation = 135处的最终图像与其他图像重叠。

Is there a way to get the plots to overlap while averaging the luminance/intensity values of each pixel? 在平均每个像素的亮度/强度值时,有没有办法使曲线重叠? Any guidance is appreciated. 任何指导表示赞赏。

Following the suggestion from Cris Luengo's comment, I combined the images before displaying by averaging the magnitude values from gaborMag . 按照克里斯·伦戈(Cris Luengo)评论的建议,我在显示之前通过平均gaborMag的幅度值来合并图像。 My code is now as follows: 我的代码现在如下:

input_img = imread('orientation.jpg');
input_img = rgb2gray(input_img);  

wavelength = 2;
orientation = [0 45 90 135];
gaborArray = gabor(wavelength,orientation);
gaborMag = imgaborfilt(input_img,gaborArray);

[height, width, num_filters] = size(gaborMag(:,:,:));
combined_mag = zeros(height,width);

% Average the values from each filter
for i = 1:height
    for j = 1:width
        sum = 0;
        for f = 1:num_filters
            sum = sum + gaborMag(i,j,f);
        end
        combined_mag(i,j) = sum / num_filters;
    end
end
imshow(combined_mag,[]);

The output is: 输出为:

结合

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM