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

📄 gfcheckfilter2.html

📁 外国人写matlab 的gobor特征运算工具箱
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"                "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head>  <title>Description of gfcheckfilter2</title>  <meta name="keywords" content="gfcheckfilter2">  <meta name="description" content="GFCHECKFILTER2 Check 2-d filter parameters.">  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">  <meta name="robots" content="index, follow">  <link type="text/css" rel="stylesheet" href="../m2html.css"></head><body><a name="_top"></a><div><a href="../index.html">Home</a> &gt;  <a href="index.html">gabortb-v0.4.1</a> &gt; gfcheckfilter2.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td><td align="right"><a href="index.html">Index for gabortb-v0.4.1&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>gfcheckfilter2</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>GFCHECKFILTER2 Check 2-d filter parameters.</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>function gfcheckfilter2(f0,theta,gamma,eta,n,pt,pf) </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre class="comment">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 <a href="gfcreatefilter2.html" class="code" title="function [g]=gfcreatefilter2(f0,theta,gamma,eta,n,varargin)">GFCREATEFILTER2</a>, <a href="gfcreatefilterf2.html" class="code" title="function [g]=gfcreatefilterf2(f0, theta, gamma, eta, N,varargin)">GFCREATEFILTERF2</a>. 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 &lt;Joni.Kamarainen@lut.fi&gt;    Ville Kyrki &lt;Ville.Kyrki@lut.fi&gt; 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 $</pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../matlabicon.gif)"></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="gfcreatefilter2.html" class="code" title="function [g]=gfcreatefilter2(f0,theta,gamma,eta,n,varargin)">gfcreatefilter2</a>	GFCREATEFILTER2 Create normalized 2-D Gabor filter in the spatial domain.</li><li><a href="gfcreatefilterf2.html" class="code" title="function [g]=gfcreatefilterf2(f0, theta, gamma, eta, N,varargin)">gfcreatefilterf2</a>	GFCREATEFILTERF2 Create normalized 2-D Gabor filter in the frequency domain.</li></ul><!-- crossreference --><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function gfcheckfilter2(f0,theta,gamma,eta,n,pt,pf)</a>0002 <span class="comment">%GFCHECKFILTER2 Check 2-d filter parameters.</span>0003 <span class="comment">%</span>0004 <span class="comment">%   GFCHECKFILTER2(F0,THETA,GAMMA,ETA,N,PT,PF)  Checks the</span>0005 <span class="comment">%   constraints of the discrete Gabor filter for given parameters</span>0006 <span class="comment">%   and prints out warning or error messages.</span>0007 <span class="comment">%</span>0008 <span class="comment">%     F0    - Central frequency</span>0009 <span class="comment">%     THETA - Orientation</span>0010 <span class="comment">%     GAMMA - Width parallel to wave</span>0011 <span class="comment">%     ETA   - Orthogonal width</span>0012 <span class="comment">%     N     - Size of the filter</span>0013 <span class="comment">%     PT    - Spatial domain percent factor</span>0014 <span class="comment">%     PF   - Frequency domain Percent factor, (major and minor axes)</span>0015 <span class="comment">%</span>0016 <span class="comment">%   Examples</span>0017 <span class="comment">%</span>0018 <span class="comment">%     gfcheckfilter2(1/64, pi/2, 1, 1, 64, 0.998, 0.998);</span>0019 <span class="comment">%     gfcheckfilter2(1/64, pi/2, 1, 1, 64, 0.998, [0.998 0.95]);</span>0020 <span class="comment">%</span>0021 <span class="comment">%   See also GFCREATEFILTER2, GFCREATEFILTERF2.</span>0022 <span class="comment">%</span>0023 <span class="comment">% References:</span>0024 <span class="comment">%   [1] Kamarainen, J.-K., Kyrki, V., Kalviainen, H., Gabor</span>0025 <span class="comment">%       Features for Invariant Object Recognition, Research</span>0026 <span class="comment">%       report 79, Department of Information Technology,</span>0027 <span class="comment">%       Lappeenranta University of Technology</span>0028 <span class="comment">%   [2] Kamarainen, Joni-Kristian, Feature Extraction with Gabor</span>0029 <span class="comment">%       Filters, PhD thesis, Lappeenranta University of Technology,</span>0030 <span class="comment">%       2003.</span>0031 <span class="comment">%</span>0032 <span class="comment">% Author(s):</span>0033 <span class="comment">%    Joni Kamarainen &lt;Joni.Kamarainen@lut.fi&gt;</span>0034 <span class="comment">%    Ville Kyrki &lt;Ville.Kyrki@lut.fi&gt;</span>0035 <span class="comment">%</span>0036 <span class="comment">% Copyright:</span>0037 <span class="comment">%</span>0038 <span class="comment">%   The Gabor Features in Signal and Image Processing Toolbox is</span>0039 <span class="comment">%   Copyright (C) 2000 by Joni Kamarainen and Ville Kyrki.</span>0040 <span class="comment">%</span>0041 <span class="comment">%</span>0042 <span class="comment">%   $Name:  $ $Revision: 1.7 $  $Date: 2003-05-02 12:11:06 $</span>0043 <span class="comment">%</span>0044 0045 <span class="comment">% Check filter size parameter</span>0046 <span class="keyword">if</span> length(n)&gt;1,0047   nx=n(1);0048   ny=n(2);0049 <span class="keyword">else</span>0050   nx=n;0051   ny=n;0052 <span class="keyword">end</span>;0053 0054 <span class="comment">% Check if different values for major and minor axes of Frequency</span>0055 <span class="comment">% domain Gaussian envelope</span>0056 <span class="keyword">if</span> length(pf)&gt;1,0057   pf1 = pf(1);0058   pf2 = pf(2);0059 <span class="keyword">else</span>0060   pf1 = pf;0061   pf2 = pf;0062 <span class="keyword">end</span>;0063 0064 <span class="comment">% Set checking values</span>0065 alpha = f0/gamma;0066 beta = f0/eta;0067 nyqf = 0.5; <span class="comment">% Nyquist frequency</span>0068 0069 <span class="comment">%</span>0070 <span class="comment">% 1. Checking Nyquist criterion</span>0071 <span class="keyword">if</span> (abs(f0) &gt; nyqf)0072   warning([<span class="string">'Nyquist criterion violated. Allowed intervals are'</span> <span class="keyword">...</span>0073       <span class="string">' ]0,0.5[ for positive and ]-0.5,0[ for negative frequencies'</span>]);0074 <span class="keyword">end</span>;0075 0076 0077 <span class="comment">%</span>0078 <span class="comment">% 2. Checking zero frequency constraint</span>0079 <span class="keyword">if</span> (f0 == 0)0080   error([<span class="string">'Zero frequency is not allowed due to the filter normalization '</span> <span class="keyword">...</span>0081      <span class="string">'(division by zero).'</span>]);0082 <span class="keyword">end</span>;0083 0084 0085 <span class="comment">%</span>0086 <span class="comment">% 3. Checking frequency constraint</span>0087 0088 <span class="comment">% more strict from [2] - works for positive and negative frequencies</span>0089 PF = min([pf1 pf2]);0090 f = f0;0091 L = min([nx ny]);0092 fPF = 1/4*(erf(gamma*pi)+erf((gamma*pi)/abs(f)*(1/2-1/L)-gamma*pi))*<span class="keyword">...</span>0093       (erf(eta*pi)+erf((eta*pi)/abs(f)*(1/2-1/L)-eta*pi));0094 0095 <span class="keyword">if</span> (fPF &lt; PF)0096   warning([<span class="string">'Filter envelope insufficiently located in the frequency domain. '</span><span class="keyword">...</span>0097        <span class="string">' Requested minimum envelope area inside legal area ]0,0.5[ or ]-0.5,0[ in frequency domain is '</span><span class="keyword">...</span><span class="comment"> </span>0098        num2str(100*PF) <span class="string">' percent and currently area is '</span> <span class="keyword">...</span>0099        num2str(100*fPF) <span class="string">'. Thus aliasing occurs!'</span>]);0100 <span class="keyword">end</span>;0101 0102 0103 <span class="comment">%</span>0104 <span class="comment">% 4. Checking time constraint</span>0105 0106 <span class="comment">% Symmetric part of the filter must contain pt percent of the</span>0107 <span class="comment">% full filter envelope</span>0108 0109 <span class="comment">%% from [1]</span>0110 <span class="comment">%fPT = erf(alpha*floor((N-1)/2));</span>0111 PT = pt;0112 fPT = erf(abs(f)/gamma*(L/2-1))*erf(abs(f)/eta*(L/2-1));0113 0114 <span class="keyword">if</span> (fPT &lt; PT)0115   warning([<span class="string">'Spatial filter size may be too small. '</span><span class="keyword">...</span>0116        <span class="string">' Requested minimum spatial envelope size is '</span><span class="keyword">...</span>0117        num2str(PT*100) <span class="string">' percent and current size is '</span><span class="keyword">...</span>0118        num2str(100*fPT)]);0119 <span class="keyword">end</span>;0120 0121 0122 0123 0124 <span class="comment">% DEPRICATED FROM [1]</span>0125 <span class="comment">%%</span>0126 <span class="comment">%% Checking spatial constraints</span>0127 <span class="comment">%</span>0128 <span class="comment">%% Symmetric part of the filter must contain pt percent of the</span>0129 <span class="comment">%% full filter envelope</span>0130 <span class="comment">%% Lasketaan 'leveydet' aallon suunnassa ja aaltoa vastaan kohtisuoraan</span>0131 <span class="comment">%lx=max(abs([cos(theta)*nx sin(theta)*ny]));</span>0132 <span class="comment">%ly=max(abs([sin(theta)*nx cos(theta)*ny]));</span>0133 <span class="comment">%</span>0134 <span class="comment">%% Filtterin symmetrisen osan tulee sis锟絫锟

⌨️ 快捷键说明

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