Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 4f45e7bdfd4a5ff17f5f8eaab90d017f > files > 983

albumshaper-2.1-6mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>AlbumShaper: edgeDetect.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>edgeDetect.h</h1><a href="edgeDetect_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==============================================</span>
<a name="l00002"></a>00002 <span class="comment">//  copyright            : (C) 2003-2005 by Will Stokes</span>
<a name="l00003"></a>00003 <span class="comment">//==============================================</span>
<a name="l00004"></a>00004 <span class="comment">//  This program is free software; you can redistribute it </span>
<a name="l00005"></a>00005 <span class="comment">//  and/or modify it under the terms of the GNU General </span>
<a name="l00006"></a>00006 <span class="comment">//  Public License as published by the Free Software </span>
<a name="l00007"></a>00007 <span class="comment">//  Foundation; either version 2 of the License, or  </span>
<a name="l00008"></a>00008 <span class="comment">//  (at your option) any later version.         </span>
<a name="l00009"></a>00009 <span class="comment">//==============================================</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="preprocessor">#ifndef BACKEND_MANIPULATIONS_EDGEDETECTOR_H</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#define BACKEND_MANIPULATIONS_EDGEDETECTOR_H</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span>
<a name="l00014"></a>00014 <span class="comment">//--------------------</span>
<a name="l00015"></a>00015 <span class="comment">//forward declarations</span>
<a name="l00016"></a>00016 <span class="comment">//--------------------</span>
<a name="l00017"></a>00017 <span class="keyword">class </span>QImage;
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="comment">//--------------------</span>
<a name="l00020"></a><a class="code" href="structLUTentry.html">00020</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00021"></a>00021 {
<a name="l00022"></a><a class="code" href="structLUTentry.html#79e744afdd51960ebb78ef4b355555b6">00022</a>   <span class="keywordtype">float</span> ESF;
<a name="l00023"></a><a class="code" href="structLUTentry.html#86dd3feb468680e96a44c5405501ea8f">00023</a>   <span class="keywordtype">int</span> direction;
<a name="l00024"></a>00024 } <a class="code" href="structLUTentry.html">LUTentry</a>;
<a name="l00025"></a>00025 <span class="comment">//--------------------</span>
<a name="l00026"></a><a class="code" href="structPixelCluster.html">00026</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00027"></a>00027 {
<a name="l00028"></a><a class="code" href="structPixelCluster.html#f04a85edff17ca2875092a8c91895bc8">00028</a>   <span class="keywordtype">int</span> minLuminance;
<a name="l00029"></a><a class="code" href="structPixelCluster.html#990df866c018513ff1c6cda90ed44315">00029</a>   <span class="keywordtype">int</span> maxLuminance;
<a name="l00030"></a>00030 
<a name="l00031"></a><a class="code" href="structPixelCluster.html#b0dcb87764ab5cce813ddb44138c3fda">00031</a>   <span class="keywordtype">int</span> edgeMagHistogram[256];
<a name="l00032"></a><a class="code" href="structPixelCluster.html#3f98d264471c9e9526b2304db1a17340">00032</a>   <span class="keywordtype">float</span> totalEdgeMagnitude;
<a name="l00033"></a><a class="code" href="structPixelCluster.html#3166f6edbbe6ffdb444d03a9cba44938">00033</a>   <span class="keywordtype">int</span> numPixels;
<a name="l00034"></a>00034 
<a name="l00035"></a>00035   <span class="comment">//normalized inputs for fuzzy logic process</span>
<a name="l00036"></a><a class="code" href="structPixelCluster.html#75ec6ec925d0d1321c1db40439d30e27">00036</a>   <span class="keywordtype">float</span> meanMode;
<a name="l00037"></a><a class="code" href="structPixelCluster.html#fdd138d50bba29d70be4569ed676658d">00037</a>   <span class="keywordtype">float</span> mode;
<a name="l00038"></a><a class="code" href="structPixelCluster.html#f20c19527f28e828acd2f1706b6d4759">00038</a>   <span class="keywordtype">float</span> pixelCount;
<a name="l00039"></a>00039   
<a name="l00040"></a><a class="code" href="structPixelCluster.html#1b862ff6db49e21b7c51f62364775fa9">00040</a>   <span class="keywordtype">float</span> beta;
<a name="l00041"></a><a class="code" href="structPixelCluster.html#62e75ced0c1818f658904e6878807780">00041</a>   <span class="keywordtype">float</span> edgeThreshold;
<a name="l00042"></a>00042   
<a name="l00043"></a>00043 } <a class="code" href="structPixelCluster.html">PixelCluster</a>;
<a name="l00044"></a>00044 <span class="comment">//--------------------</span>
<a name="l00045"></a><a class="code" href="classEdgeDetect.html">00045</a> <span class="keyword">class </span><a class="code" href="classEdgeDetect.html">EdgeDetect</a>
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047 <span class="keyword">public</span>:
<a name="l00048"></a>00048   <a class="code" href="classEdgeDetect.html#93ce81fe76863da08e2a6277a79059d1">EdgeDetect</a>( QImage* <a class="code" href="classEdgeDetect.html#511da5a85c2e50215d7e543ae6abb7a5">image</a> );
<a name="l00049"></a>00049   <a class="code" href="classEdgeDetect.html#741ddd9c27d9ff132a2cea17421e8da2">~EdgeDetect</a>(); 
<a name="l00050"></a>00050   <span class="keywordtype">int</span> <a class="code" href="classEdgeDetect.html#4a04903c7747f5668e7283f0e5085693">getNumClusters</a>();
<a name="l00051"></a>00051   <a class="code" href="structPixelCluster.html">PixelCluster</a>* <a class="code" href="classEdgeDetect.html#99b5e0b5becf716cfeb0ad163ad4a92f">getClusters</a>();
<a name="l00052"></a>00052   <span class="keywordtype">int</span>* <a class="code" href="classEdgeDetect.html#5f01a87186aeea8df552b7d5286e5cb0">getSmoothHist</a>();
<a name="l00053"></a>00053   <span class="keywordtype">int</span>* <a class="code" href="classEdgeDetect.html#303a18732250eee8f134c7be7a0e0e55">getPeaks</a>();
<a name="l00054"></a>00054   QImage* <a class="code" href="classEdgeDetect.html#aa42152fcc1734d099cede699d21475b">getEdgeImage</a>();
<a name="l00055"></a>00055   <span class="keywordtype">int</span>* <a class="code" href="classEdgeDetect.html#ee7ef6f45c78c478c830c3044de4d542">getClusterMap</a>();
<a name="l00056"></a>00056   <span class="comment">//----------------------</span>
<a name="l00057"></a>00057 <span class="keyword">private</span>:
<a name="l00058"></a>00058   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#26cb445f858697fcea929855da3629f2">allocateAndInitObjects</a>();
<a name="l00059"></a>00059   
<a name="l00060"></a>00060   <span class="comment">//construct a lookup table indexed by computed GSLC codes for applying N(on) M(aximum) S(uppression)</span>
<a name="l00061"></a>00061   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#c3889f3dd58427f42936eb9467741fe0">constructGSLClut</a>();
<a name="l00062"></a>00062   
<a name="l00063"></a>00063   <span class="comment">//iterate over each pixel computing luminance values for lum map and update lum histogram</span>
<a name="l00064"></a>00064   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#05b728eb0943f909e134842b02052565">fillLumMapAndLumHistogram</a>();
<a name="l00065"></a>00065   
<a name="l00066"></a>00066   <span class="comment">//fill smooth lum histogram using lum histogram</span>
<a name="l00067"></a>00067   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#ec8bdac9c2114f092f05814ad7b4f74a">smoothLumHistogram</a>();
<a name="l00068"></a>00068   
<a name="l00069"></a>00069   <span class="comment">//compute edge magnitude, and GSLC for each pixel</span>
<a name="l00070"></a>00070   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#e3c0ba3ea2ff407e768b5616c450396a">computeEdgeMagAndGSLCmaps</a>();
<a name="l00071"></a>00071     
<a name="l00072"></a>00072   <span class="comment">//get pixel luminance for an abritrary pixel, clamping of coordinates performed automatically</span>
<a name="l00073"></a>00073   <span class="keywordtype">int</span> <a class="code" href="classEdgeDetect.html#ffff454457969355d2f90572f96703b4">pixelLum</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
<a name="l00074"></a>00074   
<a name="l00075"></a>00075   <span class="comment">//determine pixel clusters using smooth lum histogram</span>
<a name="l00076"></a>00076   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#477c9053957296eb31a3283d78383b5b">findPixelClusters</a>();
<a name="l00077"></a>00077 
<a name="l00078"></a>00078   <span class="comment">//compute cluster stats by iterating over image luminance map</span>
<a name="l00079"></a>00079   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#3544afda112033f48d5c4710e0ab939a">computeClusterStatistics</a>();
<a name="l00080"></a>00080   
<a name="l00081"></a>00081   <span class="comment">//compute edge thresholds for each cluster using 18-rule fuzzy logic approach</span>
<a name="l00082"></a>00082   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#4640011128060980261ef336df335379">computeClusterThresholds</a>();
<a name="l00083"></a>00083   
<a name="l00084"></a>00084   <span class="comment">//replace image with blurred-normalized edge image</span>
<a name="l00085"></a>00085   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#5ece76d2c80f08b9d43153a3231198eb">constructEdgeImage</a>();
<a name="l00086"></a>00086   
<a name="l00087"></a>00087   <span class="keywordtype">void</span> <a class="code" href="classEdgeDetect.html#57edec262a4b948c6e6e70ef0801a302">deallocateObjects</a>();
<a name="l00088"></a>00088   <span class="comment">//----------------------</span>
<a name="l00089"></a>00089   <span class="comment">//GSLC LUT table</span>
<a name="l00090"></a><a class="code" href="classEdgeDetect.html#67919ec1f138bd5dcbc3ad32990a16d0">00090</a>   <a class="code" href="structLUTentry.html">LUTentry</a> <a class="code" href="classEdgeDetect.html#67919ec1f138bd5dcbc3ad32990a16d0">LUT</a>[256];
<a name="l00091"></a>00091 
<a name="l00092"></a>00092   <span class="comment">//loaded image</span>
<a name="l00093"></a><a class="code" href="classEdgeDetect.html#511da5a85c2e50215d7e543ae6abb7a5">00093</a>   QImage* image;
<a name="l00094"></a>00094   
<a name="l00096"></a><a class="code" href="classEdgeDetect.html#efd542b963f17beeb6ef75261b78ac8a">00096</a>   <span class="keywordtype">int</span> <a class="code" href="classEdgeDetect.html#efd542b963f17beeb6ef75261b78ac8a" title="luminosity and smooth luminosity histograms">lumHist</a>[256];
<a name="l00097"></a><a class="code" href="classEdgeDetect.html#3d33df65d9ab4b34082d64151a1294be">00097</a>   <span class="keywordtype">int</span> <a class="code" href="classEdgeDetect.html#3d33df65d9ab4b34082d64151a1294be">smoothLumHist</a>[256];
<a name="l00098"></a>00098 
<a name="l00099"></a>00099   <span class="comment">//cluster peaks</span>
<a name="l00100"></a><a class="code" href="classEdgeDetect.html#5aa24028e91a394d3cd5bd807e9cd84c">00100</a>   <span class="keywordtype">int</span> <a class="code" href="classEdgeDetect.html#5aa24028e91a394d3cd5bd807e9cd84c">clusterPeaks</a>[256];
<a name="l00101"></a>00101 
<a name="l00102"></a>00102   <span class="comment">//luminance map</span>
<a name="l00103"></a><a class="code" href="classEdgeDetect.html#2640fdd41a06c72f469e7790c38ea88d">00103</a>   <span class="keywordtype">int</span>* <a class="code" href="classEdgeDetect.html#2640fdd41a06c72f469e7790c38ea88d">lumMap</a>;
<a name="l00104"></a>00104 
<a name="l00105"></a>00105   <span class="comment">//edge magnitude map</span>
<a name="l00106"></a><a class="code" href="classEdgeDetect.html#f900ff52156cd0fb2159f35a75c10d7f">00106</a>   <span class="keywordtype">float</span>* <a class="code" href="classEdgeDetect.html#f900ff52156cd0fb2159f35a75c10d7f">edgeMagMap</a>;
<a name="l00107"></a>00107   
<a name="l00108"></a>00108   <span class="comment">//GSLC map</span>
<a name="l00109"></a><a class="code" href="classEdgeDetect.html#fd33a5703bc7be4f14400b26d8004668">00109</a>   <span class="keywordtype">int</span>* <a class="code" href="classEdgeDetect.html#fd33a5703bc7be4f14400b26d8004668">GSLCmap</a>; 
<a name="l00110"></a>00110 
<a name="l00111"></a>00111   <span class="comment">//pixel clusters</span>
<a name="l00112"></a><a class="code" href="classEdgeDetect.html#d9917825c8d8a4d6cf0397b3f44b443d">00112</a>   <span class="keywordtype">int</span> <a class="code" href="classEdgeDetect.html#d9917825c8d8a4d6cf0397b3f44b443d">numClusters</a>;
<a name="l00113"></a><a class="code" href="classEdgeDetect.html#2b59cd7d4e724d761de259463c8b7425">00113</a>   <a class="code" href="structPixelCluster.html">PixelCluster</a>* <a class="code" href="classEdgeDetect.html#2b59cd7d4e724d761de259463c8b7425">clusters</a>;
<a name="l00114"></a>00114   
<a name="l00115"></a>00115   <span class="comment">//min and max # of pixels in clusters</span>
<a name="l00116"></a><a class="code" href="classEdgeDetect.html#8af7e6ca7454475fbb278244c330e49c">00116</a>   <span class="keywordtype">int</span> <a class="code" href="classEdgeDetect.html#8af7e6ca7454475fbb278244c330e49c">minClusterSize</a>, <a class="code" href="classEdgeDetect.html#c9a19ea58c96694c13a65fceddfe3153">maxClusterSize</a>;
<a name="l00117"></a>00117 <span class="comment">//----------------------</span>
<a name="l00118"></a>00118 };
<a name="l00119"></a>00119 <span class="comment">//======================</span>
<a name="l00120"></a>00120 
<a name="l00121"></a>00121 <span class="preprocessor">#endif //BACKEND_MANIPULATIONS_EDGEDETECTOR_H</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:25 2009 for AlbumShaper by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>