⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gfcheckfilter2.m

📁 外国人写matlab 的gobor特征运算工具箱
💻 M
字号:
function gfcheckfilter2(f0,theta,gamma,eta,n,pt,pf)%GFCHECKFILTER2 Check 2-d filter parameters.%%   GFCHECKFILTER2(F0,THETA,GAMMA,ETA,N,PT,PF)  Checks the%   constraints of the discrete Gabor filter for given parameters%   and prints out warning or error messages.%%     F0    - Central frequency%     THETA - Orientation%     GAMMA - Width parallel to wave%     ETA   - Orthogonal width%     N     - Size of the filter%     PT    - Spatial domain percent factor%     PF   - Frequency domain Percent factor, (major and minor axes)%%   Examples%%     gfcheckfilter2(1/64, pi/2, 1, 1, 64, 0.998, 0.998);%     gfcheckfilter2(1/64, pi/2, 1, 1, 64, 0.998, [0.998 0.95]);%%   See also GFCREATEFILTER2, GFCREATEFILTERF2.%% References:%   [1] Kamarainen, J.-K., Kyrki, V., Kalviainen, H., Gabor%       Features for Invariant Object Recognition, Research%       report 79, Department of Information Technology,%       Lappeenranta University of Technology %   [2] Kamarainen, Joni-Kristian, Feature Extraction with Gabor%       Filters, PhD thesis, Lappeenranta University of Technology,%       2003. %% Author(s):%    Joni Kamarainen <Joni.Kamarainen@lut.fi>%    Ville Kyrki <Ville.Kyrki@lut.fi>%% Copyright:%%   The Gabor Features in Signal and Image Processing Toolbox is%   Copyright (C) 2000 by Joni Kamarainen and Ville Kyrki.%%%   $Name:  $ $Revision: 1.7 $  $Date: 2003-05-02 12:11:06 $%% Check filter size parameterif length(n)>1,  nx=n(1);  ny=n(2);else  nx=n;  ny=n;end;% Check if different values for major and minor axes of Frequency% domain Gaussian envelopeif length(pf)>1,  pf1 = pf(1);  pf2 = pf(2);else  pf1 = pf;  pf2 = pf;end;% Set checking valuesalpha = f0/gamma;beta = f0/eta;nyqf = 0.5; % Nyquist frequency %% 1. Checking Nyquist criterionif (abs(f0) > nyqf)  warning(['Nyquist criterion violated. Allowed intervals are' ...	  ' ]0,0.5[ for positive and ]-0.5,0[ for negative frequencies']);end;%% 2. Checking zero frequency constraintif (f0 == 0)  error(['Zero frequency is not allowed due to the filter normalization ' ...	 '(division by zero).']);end;%% 3. Checking frequency constraint% more strict from [2] - works for positive and negative frequenciesPF = min([pf1 pf2]);f = f0;L = min([nx ny]);fPF = 1/4*(erf(gamma*pi)+erf((gamma*pi)/abs(f)*(1/2-1/L)-gamma*pi))*...      (erf(eta*pi)+erf((eta*pi)/abs(f)*(1/2-1/L)-eta*pi));if (fPF < PF)  warning(['Filter envelope insufficiently located in the frequency domain. '...	   ' Requested minimum envelope area inside legal area ]0,0.5[ or ]-0.5,0[ in frequency domain is '... 	   num2str(100*PF) ' percent and currently area is ' ...	   num2str(100*fPF) '. Thus aliasing occurs!']);end;%% 4. Checking time constraint% Symmetric part of the filter must contain pt percent of the% full filter envelope %% from [1]%fPT = erf(alpha*floor((N-1)/2));PT = pt;fPT = erf(abs(f)/gamma*(L/2-1))*erf(abs(f)/eta*(L/2-1));if (fPT < PT)  warning(['Spatial filter size may be too small. '...	   ' Requested minimum spatial envelope size is '...	   num2str(PT*100) ' percent and current size is '...	   num2str(100*fPT)]);end;% DEPRICATED FROM [1]%%%% Checking spatial constraints%%% Symmetric part of the filter must contain pt percent of the%% full filter envelope %% Lasketaan 'leveydet' aallon suunnassa ja aaltoa vastaan kohtisuoraan%lx=max(abs([cos(theta)*nx sin(theta)*ny]));%ly=max(abs([sin(theta)*nx cos(theta)*ny]));%	   %% Filtterin symmetrisen osan tulee sis鋖t滗 pt prosenttia %fpt = abs(erf(alpha*floor((lx-1)/2))*erf(beta*floor((ly-1)/2)));%if (fpt < pt)%  warning(['Spatial filter size may be too small. '...%	   ' Requested minimum spatial envelope size is '...%	   num2str(pt*100) ' percent and current size is '...%	   num2str(100*fpt)]);%end;%%%%% Checking frequency constraints%%% marjor axis constraints%fpf1 = erf(pi/alpha*f0);%if (fpf1 < pf1)%  warning(['Filter envelope insufficiently located along the major axis in the frequency domain. '...%	   ' Requested minimum envelope area inside domain is '...%	   num2str(100*pf1) ' percent and currently area is ' ...%	   num2str(100*fpf1)]);%%  warning(['Area of filter envelope along the major axis insufficient' ...%%	   ' in frequency domain']); %end;%%% minor axis constraints%fpf2 = erf(pi/(beta)*1/2);%if (fpf2 < pf2)%  warning(['Filter envelope insufficiently located along the minor axis in the frequency domain. '...%	   ' Requested minimum envelope area inside domain is '...%	   num2str(100*pf2) ' percent and currently area is ' ...%	   num2str(100*fpf2)]);%%  warning(['Area of filter envelope along the minor axis insufficient' ...%%	   ' in frequency domain']); %end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -