Sophie

Sophie

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

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: redEye.h File Reference</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>
</div>
<div class="contents">
<h1>redEye.h File Reference</h1>
<p>
<div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dynsection">
</div>

<p>
<a href="redEye_8h_source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QImage *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8h.html#9800b402cdeacfa7e0e9ec756c0b54dc">removeRedeyeRegions</a> (QString filename, QPoint topLeftExtreme, QPoint bottomRightExtreme, <a class="el" href="classStatusWidget.html">StatusWidget</a> *<a class="el" href="redEye__internal_8h.html#65b682074aef9e63bb1dad48c3e9e9df">status</a>)</td></tr>

</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="9800b402cdeacfa7e0e9ec756c0b54dc"></a><!-- doxytag: member="redEye.h::removeRedeyeRegions" ref="9800b402cdeacfa7e0e9ec756c0b54dc" args="(QString filename, QPoint topLeftExtreme, QPoint bottomRightExtreme, StatusWidget *status)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QImage* removeRedeyeRegions           </td>
          <td>(</td>
          <td class="paramtype">QString&nbsp;</td>
          <td class="paramname"> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QPoint&nbsp;</td>
          <td class="paramname"> <em>topLeftExtreme</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QPoint&nbsp;</td>
          <td class="paramname"> <em>bottomRightExtreme</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classStatusWidget.html">StatusWidget</a> *&nbsp;</td>
          <td class="paramname"> <em>status</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00206">206</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p>

<p>References <a class="el" href="redEye_8cpp_source.html#l00612">desaturateBlobs()</a>, <a class="el" href="redEye_8cpp_source.html#l00643">desaturateEntireImage()</a>, <a class="el" href="redEye__internal_8h_source.html#l00037">editedImage</a>, <a class="el" href="redEye_8cpp_source.html#l00506">findBestTwoBlobs()</a>, <a class="el" href="redEye_8cpp_source.html#l00372">findBlobs()</a>, <a class="el" href="redEye_8cpp_source.html#l00305">findRegionOfInterest()</a>, <a class="el" href="redEye__internal_8h_source.html#l00071">id1</a>, <a class="el" href="redEye__internal_8h_source.html#l00031">newProgress</a>, <a class="el" href="redEye__internal_8h_source.html#l00034">rawImage</a>, <a class="el" href="statusWidget_8cpp_source.html#l00125">StatusWidget::setStatus()</a>, <a class="el" href="statusWidget_8cpp_source.html#l00089">StatusWidget::showProgressBar()</a>, <a class="el" href="redEye_8cpp_source.html#l00468">sortBlobsByDecreasingSize()</a>, <a class="el" href="redEye__internal_8h_source.html#l00021">status</a>, <a class="el" href="redEye__internal_8h_source.html#l00042">topLeft</a>, and <a class="el" href="redEye__internal_8h_source.html#l00028">updateIncrement</a>.</p>

<p>Referenced by <a class="el" href="editingInterface_8cpp_source.html#l00694">EditingInterface::removeRedeye()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00209"></a>00209 {
<a name="l00210"></a>00210   <span class="comment">//store handle to status widget</span>
<a name="l00211"></a>00211   status = statusWidget;
<a name="l00212"></a>00212   
<a name="l00213"></a>00213   <span class="comment">//load original image</span>
<a name="l00214"></a>00214   <a class="code" href="redEye__internal_8h.html#5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a> = QImage( filename );
<a name="l00215"></a>00215   
<a name="l00216"></a>00216   <span class="comment">//sanity check: unable to load image</span>
<a name="l00217"></a>00217   <span class="keywordflow">if</span>(<a class="code" href="redEye__internal_8h.html#5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.isNull()) { <span class="keywordflow">return</span> NULL; }
<a name="l00218"></a>00218 
<a name="l00219"></a>00219   <span class="comment">//convert to 32-bit depth if necessary</span>
<a name="l00220"></a>00220   <span class="keywordflow">if</span>( <a class="code" href="redEye__internal_8h.html#5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.depth() &lt; 32 ) { <a class="code" href="redEye__internal_8h.html#5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a> = <a class="code" href="redEye__internal_8h.html#5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.convertDepth( 32, Qt::AutoColor ); }
<a name="l00221"></a>00221    
<a name="l00222"></a>00222   <span class="comment">//sanity check: make sure topLeftExtreme and bottomRightExtreme are within image boundary</span>
<a name="l00223"></a>00223   topLeftExtreme.setX( QMAX( topLeftExtreme.x(), 0 ) );
<a name="l00224"></a>00224   topLeftExtreme.setY( QMAX( topLeftExtreme.y(), 0 ) );
<a name="l00225"></a>00225   bottomRightExtreme.setX( QMIN( bottomRightExtreme.x(), <a class="code" href="redEye__internal_8h.html#5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.width()-1 ) );
<a name="l00226"></a>00226   bottomRightExtreme.setY( QMIN( bottomRightExtreme.y(), <a class="code" href="redEye__internal_8h.html#5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.height()-1 ) );
<a name="l00227"></a>00227 
<a name="l00228"></a>00228   <span class="comment">//setup progress bar</span>
<a name="l00229"></a>00229   QString statusMessage = qApp-&gt;translate( <span class="stringliteral">"removeRedeyeRegions"</span>, <span class="stringliteral">"Removing Red-Eye:"</span> );
<a name="l00230"></a>00230   status-&gt;<a class="code" href="classStatusWidget.html#57d461014070b9d651c36bd157cab9c1" title="Initializes the progress bar.">showProgressBar</a>( statusMessage, 100 );
<a name="l00231"></a>00231   qApp-&gt;processEvents();  
<a name="l00232"></a>00232   
<a name="l00233"></a>00233   <span class="comment">//update progress bar for every 1% of completion</span>
<a name="l00234"></a>00234   <a class="code" href="redEye__internal_8h.html#32598f506d413f48cda8e1c930dae6b3">updateIncrement</a> = (int) ( 0.01 * 
<a name="l00235"></a>00235                             ( bottomRightExtreme.x() - topLeftExtreme.x() + 1 ) *
<a name="l00236"></a>00236                             ( bottomRightExtreme.y() - topLeftExtreme.y() + 1 ) );
<a name="l00237"></a>00237   <a class="code" href="redEye__internal_8h.html#caa08422437cae250a76ca488cbe1567">newProgress</a> = 0;   
<a name="l00238"></a>00238 
<a name="l00239"></a>00239   <span class="comment">//find region of interest: constrain search box to boundary that actually contains red enough pixels</span>
<a name="l00240"></a>00240   <a class="code" href="redEye_8cpp.html#bf1a28f820dfa8bba3056128a76e2b31">findRegionOfInterest</a>(topLeftExtreme, bottomRightExtreme);
<a name="l00241"></a>00241 
<a name="l00242"></a>00242   <span class="comment">//if no pixels were found then immediately return a NULL pointer signaling no change</span>
<a name="l00243"></a>00243   <span class="keywordflow">if</span>(<a class="code" href="redEye__internal_8h.html#6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x() == -1) 
<a name="l00244"></a>00244   { 
<a name="l00245"></a>00245     <span class="comment">//hide progress bar</span>
<a name="l00246"></a>00246     status-&gt;<a class="code" href="classStatusWidget.html#02084869ff1c15dab4bc922a49b31808" title="Update message.">setStatus</a>( <span class="stringliteral">""</span> );
<a name="l00247"></a>00247     qApp-&gt;processEvents();
<a name="l00248"></a>00248 
<a name="l00249"></a>00249     <span class="keywordflow">return</span> NULL; 
<a name="l00250"></a>00250   }
<a name="l00251"></a>00251 
<a name="l00252"></a>00252   <span class="comment">//load an editing image</span>
<a name="l00253"></a>00253   <span class="comment">//two images mus be loaded becuase pixel values are replaced</span>
<a name="l00254"></a>00254   <span class="comment">//using a compbination of niehgbors and their own in order</span>
<a name="l00255"></a>00255   <span class="comment">//to avoid sharp lines at the edge of the saturated region</span>
<a name="l00256"></a>00256   <a class="code" href="redEye__internal_8h.html#63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a> = <span class="keyword">new</span> QImage( filename );
<a name="l00257"></a>00257   
<a name="l00258"></a>00258   <span class="comment">//sanity check: unable to allocated edited image</span>
<a name="l00259"></a>00259   <span class="keywordflow">if</span>( <a class="code" href="redEye__internal_8h.html#63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a> == NULL) 
<a name="l00260"></a>00260   { 
<a name="l00261"></a>00261     <span class="comment">//hide progress bar</span>
<a name="l00262"></a>00262     status-&gt;<a class="code" href="classStatusWidget.html#02084869ff1c15dab4bc922a49b31808" title="Update message.">setStatus</a>( <span class="stringliteral">""</span> );
<a name="l00263"></a>00263     qApp-&gt;processEvents();
<a name="l00264"></a>00264 
<a name="l00265"></a>00265     <span class="keywordflow">return</span> NULL; 
<a name="l00266"></a>00266   }
<a name="l00267"></a>00267 
<a name="l00268"></a>00268   <span class="comment">//convert to 32-bit depth if necessary</span>
<a name="l00269"></a>00269   <span class="keywordflow">if</span>( <a class="code" href="redEye__internal_8h.html#63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>-&gt;depth() &lt; 32 )
<a name="l00270"></a>00270   {
<a name="l00271"></a>00271     QImage* tmp = <a class="code" href="redEye__internal_8h.html#63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>;
<a name="l00272"></a>00272     <a class="code" href="redEye__internal_8h.html#63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a> = <span class="keyword">new</span> QImage( tmp-&gt;convertDepth( 32, Qt::AutoColor ) );
<a name="l00273"></a>00273     <span class="keyword">delete</span> tmp; tmp=NULL;
<a name="l00274"></a>00274   }
<a name="l00275"></a>00275   
<a name="l00276"></a>00276   <a class="code" href="redEye_8cpp.html#ee8db73b8ae2738abf7e7d45530e2aea">findBlobs</a>();
<a name="l00277"></a>00277   <a class="code" href="redEye_8cpp.html#3aaacc5ca86e794b9b1eb5cbae4b33c0">sortBlobsByDecreasingSize</a>();
<a name="l00278"></a>00278   <a class="code" href="redEye_8cpp.html#7f1ea49f9377698b39bbe4c95d3dfacf">findBestTwoBlobs</a>();
<a name="l00279"></a>00279 
<a name="l00280"></a>00280   <span class="comment">//if we found two good blobs then desaturate those only</span>
<a name="l00281"></a>00281   <span class="keywordflow">if</span>(<a class="code" href="redEye__internal_8h.html#0c133898e18cb9e8871148f231b91499">id1</a> != -1)
<a name="l00282"></a>00282   {
<a name="l00283"></a>00283     <a class="code" href="redEye_8cpp.html#58dd38d7509fe0a51a8f364190018018">desaturateBlobs</a>();
<a name="l00284"></a>00284   }
<a name="l00285"></a>00285   <span class="comment">//else desaturate all pixels above thresh within selection area</span>
<a name="l00286"></a>00286   <span class="keywordflow">else</span>
<a name="l00287"></a>00287   {
<a name="l00288"></a>00288     <a class="code" href="redEye_8cpp.html#f4dcda43e955d647a9c8e1f00056a41c">desaturateEntireImage</a>(topLeftExtreme, bottomRightExtreme);
<a name="l00289"></a>00289   }
<a name="l00290"></a>00290 
<a name="l00291"></a>00291   <span class="comment">//remove status bar</span>
<a name="l00292"></a>00292   status-&gt;<a class="code" href="classStatusWidget.html#02084869ff1c15dab4bc922a49b31808" title="Update message.">setStatus</a>( <span class="stringliteral">""</span> );
<a name="l00293"></a>00293   qApp-&gt;processEvents();
<a name="l00294"></a>00294 
<a name="l00295"></a>00295   <span class="comment">//return pointer to edited image</span>
<a name="l00296"></a>00296   <span class="keywordflow">return</span> <a class="code" href="redEye__internal_8h.html#63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>;      
<a name="l00297"></a>00297 }
</pre></div>
<p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:31 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>