📄 gfcreatefilter2.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 gfcreatefilter2</title> <meta name="keywords" content="gfcreatefilter2"> <meta name="description" content="GFCREATEFILTER2 Create normalized 2-D Gabor filter in the spatial domain."> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="m2html © 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> > <a href="index.html">gabortb-v0.4.1</a> > gfcreatefilter2.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td><td align="right"><a href="index.html">Index for gabortb-v0.4.1 <img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>gfcreatefilter2</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>GFCREATEFILTER2 Create normalized 2-D Gabor filter in the spatial domain.</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 [g]=gfcreatefilter2(f0,theta,gamma,eta,n,varargin) </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"> GFCREATEFILTER2 Create normalized 2-D Gabor filter in the spatial domain. G = GFCREATEFILTER2(F0,THETA,GAMMA,ETA,N,...) creates a two-dimensional normalized Gabor filter G with frequency F0, orientation THETA, normalized width GAMMA along the wave, normalized width ETA orthogonal to the wave, and size N. If N is a scalar, G will have equal number of rows and columns. Also a two element vector N=[NX NY] can be used to specify the size. G = GFCREATEFILTER2(...,'PF',PF) determines that at least P percent of the Gaussian envelope of the filter must be included in the filter in frequency domain. For default, PF=0.998. G = GFCREATEFILTER2(...,'PT',PT) determines that at least P percent of the Gaussian envelope of the filter must be included in the filter in spatial domain. For default, PT=0.998. Examples See also <a href="gfcreatefilterf2.html" class="code" title="function [g]=gfcreatefilterf2(f0, theta, gamma, eta, N,varargin)">GFCREATEFILTERF2</a>, <a href="gfcheckfilter2.html" class="code" title="function gfcheckfilter2(f0,theta,gamma,eta,n,pt,pf)">GFCHECKFILTER2</a>, <a href="gfcreatefilterf.html" class="code" title="function [g]=gfcreatefilterf(f0,gamma,N,varargin)">GFCREATEFILTERF</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 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.10 $ $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)"><li><a href="gfcheckfilter2.html" class="code" title="function gfcheckfilter2(f0,theta,gamma,eta,n,pt,pf)">gfcheckfilter2</a> GFCHECKFILTER2 Check 2-d filter parameters.</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="gfdemo02.html" class="code" title="function [] = gfdemo02;">gfdemo02</a> GFDEMO02 Demonstrate 2-D Gabor functionality</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 [g]=gfcreatefilter2(f0,theta,gamma,eta,n,varargin)</a>0002 <span class="comment">% GFCREATEFILTER2 Create normalized 2-D Gabor filter in the spatial domain.</span>0003 <span class="comment">%</span>0004 <span class="comment">% G = GFCREATEFILTER2(F0,THETA,GAMMA,ETA,N,...) creates a</span>0005 <span class="comment">% two-dimensional normalized Gabor filter G with frequency F0,</span>0006 <span class="comment">% orientation THETA, normalized width GAMMA along the wave,</span>0007 <span class="comment">% normalized width ETA orthogonal to the wave, and size N.</span>0008 <span class="comment">% If N is a scalar, G will have equal number of rows and</span>0009 <span class="comment">% columns. Also a two element vector N=[NX NY] can be used to</span>0010 <span class="comment">% specify the size.</span>0011 <span class="comment">%</span>0012 <span class="comment">% G = GFCREATEFILTER2(...,'PF',PF) determines that at least</span>0013 <span class="comment">% P percent of the Gaussian envelope of the filter must be</span>0014 <span class="comment">% included in the filter in frequency domain. For default,</span>0015 <span class="comment">% PF=0.998.</span>0016 <span class="comment">%</span>0017 <span class="comment">% G = GFCREATEFILTER2(...,'PT',PT) determines that at least</span>0018 <span class="comment">% P percent of the Gaussian envelope of the filter must be</span>0019 <span class="comment">% included in the filter in spatial domain. For default,</span>0020 <span class="comment">% PT=0.998.</span>0021 <span class="comment">%</span>0022 <span class="comment">% Examples</span>0023 <span class="comment">%</span>0024 <span class="comment">% See also GFCREATEFILTERF2, GFCHECKFILTER2, GFCREATEFILTERF.</span>0025 <span class="comment">%</span>0026 <span class="comment">% References:</span>0027 <span class="comment">% [1] Kamarainen, J.-K., Kyrki, V., Kalviainen, H., Gabor</span>0028 <span class="comment">% Features for Invariant Object Recognition, Research</span>0029 <span class="comment">% report 79, Department of Information Technology,</span>0030 <span class="comment">% Lappeenranta University of Technology</span>0031 <span class="comment">%</span>0032 <span class="comment">% Author(s):</span>0033 <span class="comment">% Joni Kamarainen <Joni.Kamarainen@lut.fi></span>0034 <span class="comment">% Ville Kyrki <Ville.Kyrki@lut.fi></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.10 $ $Date: 2003-05-02 12:11:06 $</span>0043 <span class="comment">%</span>0044 pt=0.998; <span class="comment">% corresponds approximately to (1-1/512)</span>0045 pf=0.998;0046 0047 <span class="keyword">if</span> mod(length(varargin),2)>0,0048 error(<span class="string">'Each parameter must be given a value.'</span>);0049 <span class="keyword">end</span>;0050 0051 currentarg=1;0052 <span class="keyword">while</span> length(varargin)>currentarg,0053 0054 [param,value]=deal(varargin{currentarg:currentarg+1});0055 0056 <span class="keyword">switch</span> lower(param)0057 <span class="keyword">case</span> <span class="string">'pt'</span>0058 pt=value;0059 <span class="keyword">otherwise</span>0060 error([<span class="string">'Unknown parameter '''</span> param <span class="string">'''.'</span>]);0061 <span class="keyword">end</span>;0062 0063 currentarg=currentarg+2;0064 <span class="keyword">end</span>;0065 0066 <a href="gfcheckfilter2.html" class="code" title="function gfcheckfilter2(f0,theta,gamma,eta,n,pt,pf)">gfcheckfilter2</a>(f0,theta,gamma,eta,n,pt,pf);0067 0068 alpha=f0/gamma;0069 beta=f0/eta;0070 0071 <span class="keyword">if</span> length(n)>1,0072 nx=n(1);0073 ny=n(2);0074 <span class="keyword">else</span>0075 nx=n;0076 ny=n;0077 <span class="keyword">end</span>;0078 0079 <span class="comment">% Parittomalla pituudella indeksit -(n-1)/2:(n-1)/2</span>0080 <span class="comment">% Parillisella -(n/2):(n/2-1)</span>0081 <span class="comment">% Esim. 9 -> -4:4, 8 -> -4:3</span>0082 <span class="keyword">if</span> mod(nx,2)>0,0083 tx=-((nx-1)/2):(nx-1)/2;0084 <span class="keyword">else</span>0085 tx=-(nx/2):(nx/2-1);0086 <span class="keyword">end</span>;0087 0088 <span class="keyword">if</span> mod(ny,2)>0,0089 ty=-((ny-1)/2):(ny-1)/2;0090 <span class="keyword">else</span>0091 ty=-(ny/2):(ny/2-1);0092 <span class="keyword">end</span>;0093 [X,Y]=meshgrid(tx,ty);0094 0095 g=abs(alpha*beta)/pi*exp(-alpha^2*(X*cos(theta)+Y*sin(theta)).^2-<span class="keyword">...</span>0096 beta^2*(-X*sin(theta)+Y*cos(theta)).^2 +<span class="keyword">...</span>0097 j*2*pi*f0*(X*cos(theta)+Y*sin(theta)));0098 0099 0100</pre></div><hr><address>Generated on Fri 23-Nov-2007 14:52:42 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -