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

📄 convexpl.html

📁 hopfield neural network for binary image recognition
💻 HTML
📖 第 1 页 / 共 2 页
字号:
symmetric filters (with the odd symmetric filter multiplied by i).</p><center><img src=combinedfilter.png></center><p>If we perform the convolution by multiplying this frequency domainfilter by the FFT of the image and take the inverse FFT we end up withthe even-symmetric convolution residing in the real part of the resultand the odd-symmetric convolution residing in the imaginary part.</p><p>Returning the result in this form is very convenient.  With thecomplex values of the the convolution result simultaneously encodingthe magnitude and phase response of the quadrature filters.</p><h3>2D Filter Construction</h3>Following describes extracts of code in <tt>phasecong2</tt>.<p>The first step is to compute a matrix the same size as the imagewhere every value of the matrix contains the normalised radius fromthe centre on the matrix.  Values range from 0 at the middle to 0.5at the boundary.<pre>  [x,y] = meshgrid([-cols/2:(cols/2-1)]/cols,...                   [-rows/2:(rows/2-1)]/rows);  radius = sqrt(x.^2 + y.^2);       % Matrix values contain *normalised* radius                                     % values ranging from 0 at the centre to                                     % 0.5 at the boundary.  radius(rows/2+1, cols/2+1) = 1;   % Get rid of the 0 radius value in the middle                                     % so that taking the log of the radius will                                     % not cause trouble.</pre>Filters are constructed in terms of two components.<ol><li> The radial component, which controls the frequency band that the filter   responds to<li> The angular component, which controls the orientation that the filter   responds to.</ol>The two components are multiplied together to construct the overall filter.<p>Here is an example of constructing the radial component of the filtergiven some desired filter wavelength.  The bandwidth of the filter is controlled by the parameter <tt>sigmaOnf</tt>.<pre>  fo = 1.0/wavelength;                  % Centre frequency of filter.  % The following implements the log-gabor transfer function.  logGabor = exp((-(log(radius/fo)).^2) / (2 * log(sigmaOnf)^2));    logGabor(rows/2+1, cols/2+1) = 0;     % Set the value at the 0 frequency point                                         % of the filter back to zero                                         % (undo the radius fudge).</pre><center><img src=loggabor.jpg><p>Radial log-Gabor component of the filter. </center>A problem is that for small wavelengths the filters can extend intothe higher frequencies in the 'corners' of the FFT, whereas in thevertical and horizontal directions the filters are cut off by theboundary. This uneven coverage depending on direction can upset thenormalisation process when calculating phase congrunecy.  To make thecoverage uniform in all directions the filters are multiplied by alow-pass filter that is as large as possible, yet falls away to zeroat the boundaries.  For most filter scales, other than the highestfrequency ones, this has no appreciable effect on the filter.Note the application of the low pass filter is only implementedin phasecong2 (so far).<pre>  lp = lowpassfilter([rows,cols],.4,10);   % Radius .4, 'sharpness' 10  logGabor = logGabor.*lp;                 % Apply low-pass filter</pre><center><table width="10%" border=0 cellpadding=10 cellspacing=0><tr><td align="top"><img src=lp.jpg><p>Large low-pass filter.<br><br><br> </td><td align="top"><img src=loggaborlp.jpg><p>Product of low-pass filter and log-Gabor filter (in this case it does nothing). </td></tr></table></center>Now we calculate the angular component that controls the orientationselectivity of the filter. This is simply a Gaussian with respect tothe polar angle around the centre.  The Gaussian is centred at someangle <tt>angl</tt>, and has standard deviation <tt>thetaSigma</tt>.<pre>  theta = atan2(-y,x);              % Matrix values contain polar angle.                                    % (note -ve y is used to give +ve                                    % anti-clockwise angles)  sintheta = sin(theta);  costheta = cos(theta);  % For each point in the filter matrix calculate the angular distance from the  % specified filter orientation.  To overcome the angular wrap-around problem  % sine difference and cosine difference values are first computed and then  % the atan2 function is used to determine angular distance.  ds = sintheta * cos(angl) - costheta * sin(angl);    % Difference in sine.  dc = costheta * cos(angl) + sintheta * sin(angl);    % Difference in cosine.  dtheta = abs(atan2(ds,dc));                          % Absolute angular distance.  spread = exp((-dtheta.^2) / (2 * thetaSigma^2));     % Calculate the angular                                                        % filter component.  filter = spread.*logGabor;                           % Product of the two components.</pre><center><table width="10%" border=0 cellpadding=10 cellspacing=0><tr><td><img src=spread.jpg><p>Angular component of the filter.<br><br><br><td><img src=filter.jpg><p>Product of angular and radial components to produce the frequency domainrepresentation of the log-Gabor filter.</tr></table></center><p>If we take the inverse Fourier Transform of this filter the even-symmetriccomponent will be in the real part of the result and odd-symmetriccomponent will be in the imaginary part of the result.<center><table width="10%" border=0 cellpadding=10 cellspacing=0><tr><td><img src=realEO.jpg><p>Even symmetric filter.<td><img src=imagEO.jpg><p>Odd symmetric filter.</tr></table></center><p>To create filters tuned to other frequencies and oriented indifferent directions one simply forms the product between theappropriate radial and angular spread components - mix and match.<hr><h2>Design of a Log-Gabor Filter Bank</h2>A Gabor, or log-Gabor, filter bank does not form an orthogonal basisset and hence there is no unique or ideal arrangement of the filters.Thus, the design of a filter bank is somewhat of an art but thefollowing should give you some guidelines.<p> One aim is to produce a filter bank that provides even coverage ofthe section of the spectrum that you wish to represent.  This can beachieved by making the overlap of the filter transfer functionssufficiently large so that when one sums the individual transferfunctions the net result is an even coverage of the spectrum. Thus,every point in the spectrum ends up being represented equally in thefinal result.  For computational reasons one wants to achieve thiseven coverage of the spectrum with a minimal number of filters.<p>A second aim, which conflicts with the first, is to ensure theoutputs of the individual filters in the bank are as independent aspossible.  The whole aim of applying the filter bank is to obtaininformation about our signal, if a filter's outputs are highlycorrelated with those of its neighbours then we have an inefficientarrangement of filters that do not provide as much information as theyshould.  To achieve independence of output the filters should haveminimal overlap of their transfer functions.<p>Thus the transfer functions of our filters should have the minimaloverlap necessary to achieve fairly even spectral coverage.<p>Here are the parameters you have to decide on, several are interdependent.<ul><li>The minimum and maximum frequencies you wish to cover.  <li>The filter bandwidth to use.<li>The scaling between centre frequencies of successive filters.<li>The number of filter scales.<li>The number of filter orientations to use.<li>The angular spread of each filter.</ul><h3>Maximum frequency</h3><p>The maximum frequency is set by the wavelength of the smallest scalefilter, this is controlled by the parameter <tt>minWaveLength</tt>.The smallest value you can sensibly use here is the Nyquist wavelengthof 2 pixels, however at this wavelength you will get considerable alaisingand I prefer to keep the minimum value to 3 pixels or above.<h3>Minimum frequency</h3><p>The minimum frequency is set by the wavelength of the largest scalefilter.  This is implicitly defined once you have set the number offilter scales (<tt>nscale</tt>), the scaling between centrefrequencies of successive filters (<tt>mult</tt>), and thewavelength of the smallest scale filter.<pre>   maximum wavelength = minWavelength * mult^(nscale-1)   minimum frequency = 1 / maximum wavelength</pre><h3>Filter bandwidth</h3><p>The filter bandwidth is set by specifying the ratio of the standarddeviation of the Gaussian describing the log Gabor filter's transferfunction in the log-frequency domain to the filter center frequency.This is set by the parameter <tt> sigmaOnf </tt>.  The smaller <tt>sigmaOnf </tt> is the larger the bandwidth of the filter.  I have notworked out an expression relating <tt>sigmaOnf</tt> to bandwidth, butempirically a <tt>sigmaOnf</tt> value of 0.75 will result in a filterwith a bandwidth of approximately 1 octave and a value of 0.55 willresult in a bandwidth of roughly 2 octaves.<!-- add material relating bandwidth to spatial extent --><h3>Scaling between centre frequencies</h3><p>Having set a filter bandwidth one is then in a position to decideon the scaling between centre frequencies of successive filters(<tt>mult</tt>).  It is here one has to play off the conflictingdemands of even spectral coverage and independence of filter output.<p>Here is a table of values, determined experimentally, that resultin the minimal overlap necessary to achieve fairly even spectralcoverage.<pre> sigmaOnf  .85   mult 1.3 sigmaOnf  .75   mult 1.6     (bandwidth ~1 octave) sigmaOnf  .65   mult 2.1 sigmaOnf  .55   mult 3       (bandwidth ~2 octaves)</pre><h3>The number of filter orientations</h3>This, in conjunction with the angular spread of each filter, specifiesthe resolution of the orientation information you obtain from thefilters.  I have traditionally used six orientations. <h3>The angular spread of each filter</h3>Here again one plays off the demands of even spectral coverage andindependence of filter output. The angular interval between filterorientations is fixed by the number of filter orientations.  In thefrequency domain the spread of 2D log-Gabor filter in the angulardirection is simply a Gaussian with respect to the polar angle aroundthe centre.  The angular overlap of the filter transfer functions iscontrolled by the ratio of the angular interval between filterorientations and the standard deviation of the angular Gaussianspreading function.  Within the code this ratio is controlled by theparameter <tt>dThetaOnSigma</tt>. A value of <tt>dThetaOnSigma</tt> =1.5 results in approximately the minimum overlap needed to get evenspectral coverage.<hr></body></html>

⌨️ 快捷键说明

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