了解Gabor过滤器库

时间:2017-10-05 19:56:37

标签: matlab image-processing signal-processing gabor-filter

我已经看过3种类型的gabor滤波器方程(复数,实数,虚数),但我仍然对这里实现的方程式感到困惑?有人可以告诉我

  1. 什么是fu?
  2. 为什么fmax = 0.25(它是什么?)?
  3. 这里使用哪个等式(gFilter(x,y))?
  4. 为什么选择eta& gama = sqrt(2)?
  5. [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
    

1 个答案:

答案 0 :(得分:0)

您是否考虑过使用MATLAB中已有的gabor过滤功能?

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

尝试理解这段代码可能是一个更好的选择。