简体   繁体   中英

Understanding Gabor filter bank

I have seen 3 types of gabor filter equation(complex,real,imaginary) but i am still confused about what equation is implemented here? Can someone tell me

  1. what is fu?
  2. why fmax=0.25(what is it?)?
  3. Which equation is used here(gFilter(x,y))?
  4. why eta & gama = sqrt(2)?

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

   % GABORFILTERBANK generates a custum Gabor filter bank. 
   % It creates a u by v cell array, whose elements are m by n matrices; 
   % 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);
   % 
   if (nargin ~= 4)    % Check correct number of arguments
   error('There must be four input arguments (Number of scales and 
   orientations and the 2-D size of the filter)!')
   end

    %% Create Gabor filters
    % Create u*v gabor filters each being an m by n matrix
    m=double(int32(m));
    n=double(int32(n));
    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

Have you considered using the gabor filtering features that are already in MATLAB?

https://www.mathworks.com/help/images/ref/gabor.html https://www.mathworks.com/help/images/ref/imgaborfilt.html

Might be a better option that trying to make sense of this code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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