如何在matlab中实现对3D图像的gabor滤镜

时间:2014-07-04 12:56:12

标签: matlab image-processing 3d feature-extraction

我正在使用3D图像,我想实现Gabor功能。为此,我需要生成具有不同比例和方向的Gabor滤波器组(可能是3D,两个角度),然后用我的图像对其进行调整。我的问题是,是否有可能实现3D gabor过滤器,然后用3D图像对其进行限制。或者我是否在2D切片中进行操作。如果是这样,任何在matlab中实现它的建议都将受到赞赏。

提前谢谢

2 个答案:

答案 0 :(得分:1)

制作2D。 Gabor滤镜会自动将您的图像更改为灰度,因此3D无论如何都会变得毫无用处。

这是matlab的gabor过滤器,我使用它并且完全正常工作。

function gaborArray = gaborFilterBank(u,v,m,n)

% GABORFILTERBANK generates a custum Gabor filter bank. 
% It creates a u by v array, whose elements are m by n matries; 
% each matrix being a 2-D Gabor filter.
% 
% 
% Inputs:
%       u   :   No. of scales (usually set to 5) 
%       v   :   No. of orientations (usually set to 8)
%       m   :   No. of rows in a 2-D Gabor filter (an odd integer number usually set to 39)
%       n   :   No. of columns in a 2-D Gabor filter (an odd integer number usually set to 39)
% 
% Output:
%       gaborArray: A u by v array, element of which are m by n 
%                   matries; each matrix being a 2-D Gabor filter   
% 
% 
% Sample use:
% 
% gaborArray = gaborFilterBank(5,8,39,39);
% 
% 
%   Details can be found in:
%   
%   M. Haghighat, S. Zonouz, M. Abdel-Mottaleb, "Identification Using 
%   Encrypted Biometrics," Computer Analysis of Images and Patterns, 
%   Springer Berlin Heidelberg, pp. 440-448, 2013.
% 
% 
% (C)   Mohammad Haghighat, University of Miami
%       haghighat@ieee.org
%       I WILL APPRECIATE IF YOU CITE OUR PAPER IN YOUR WORK.



if (nargin ~= 4)    % Check correct number of arguments
    error('There should be four inputs.')
end


%% Create Gabor filters

% Create u*v gabor filters each being an m*n matrix

gaborArray = cell(u,v);
fmax = 0.25;
gama = sqrt(2);
eta = sqrt(2);

for i = 1:u

    fu = fmax/((sqrt(2))^(i-1));
    alpha = fu/gama;
    beta = fu/eta;

    for j = 1:v
        tetav = ((j-1)/v)*pi;
        gFilter = zeros(m,n);

        for x = 1:m
            for y = 1:n
                xprime = (x-((m+1)/2))*cos(tetav)+(y-((n+1)/2))*sin(tetav);
                yprime = -(x-((m+1)/2))*sin(tetav)+(y-((n+1)/2))*cos(tetav);
                gFilter(x,y) = (fu^2/(pi*gama*eta))*exp(-((alpha^2)*(xprime^2)+(beta^2)*(yprime^2)))*exp(1i*2*pi*fu*xprime);
            end
        end
        gaborArray{i,j} = gFilter;

    end
end


%% Show Gabor filters

% Show magnitudes of Gabor filters:
figure('NumberTitle','Off','Name','Magnitudes of Gabor filters');
for i = 1:u
    for j = 1:v        
        subplot(u,v,(i-1)*v+j);        
        imshow(abs(gaborArray{i,j}),[]);
    end
end

% Show real parts of Gabor filters:
figure('NumberTitle','Off','Name','Real parts of Gabor filters');
for i = 1:u
    for j = 1:v        
        subplot(u,v,(i-1)*v+j);        
        imshow(real(gaborArray{i,j}),[]);
    end
end

答案 1 :(得分:1)

您可以通过将滤镜扩展为3维来实现3D gabor滤镜,因此它变为:

高斯(x,y,z)* exp(j * 2p *(Ux + Vy + Zz))。有关详细信息,请查看本文:

http://www.sciencedirect.com/science/article/pii/S0031320312003421#bib32