<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>AlbumShaper: redEye.cpp 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.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main 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 List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>redEye.cpp File Reference</h1><code>#include <qimage.h></code><br/> <code>#include <qstring.h></code><br/> <code>#include <qapplication.h></code><br/> <code>#include "<a class="el" href="redEye_8h_source.html">redEye.h</a>"</code><br/> <code>#include "<a class="el" href="redEye__internal_8h_source.html">redEye_internal.h</a>"</code><br/> <code>#include "../../gui/statusWidget.h"</code><br/> <div class="dynheader"> Include dependency graph for redEye.cpp:</div> <div class="dynsection"> </div> <p><a href="redEye_8cpp_source.html">Go to the source code of this file.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Defines</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#ad7ed4710f681643ffc38eedbd4523dcc">MIN_RED_VAL</a> 40</td></tr> <tr><td colspan="2"><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">QImage * </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#a08c3ef4b07c510049d36c6b0825d2455">removeRedeyeRegions</a> (QString filename, QPoint topLeftExtreme, QPoint bottomRightExtreme, <a class="el" href="classStatusWidget.html">StatusWidget</a> *statusWidget)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#abf1a28f820dfa8bba3056128a76e2b31">findRegionOfInterest</a> (QPoint topLeftExtreme, QPoint bottomRightExtreme)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a> (int x, int y, int id)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#aee8db73b8ae2738abf7e7d45530e2aea">findBlobs</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#a3aaacc5ca86e794b9b1eb5cbae4b33c0">sortBlobsByDecreasingSize</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#a7f1ea49f9377698b39bbe4c95d3dfacf">findBestTwoBlobs</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a> (int x, int y)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#a7a6d47eeb0f1fbac201599af4bda8719">desaturateAlpha</a> (int x, int y)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#a58dd38d7509fe0a51a8f364190018018">desaturateBlobs</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="redEye_8cpp.html#af4dcda43e955d647a9c8e1f00056a41c">desaturateEntireImage</a> (QPoint topLeftExtreme, QPoint bottomRightExtreme)</td></tr> </table> <hr/><h2>Define Documentation</h2> <a class="anchor" id="ad7ed4710f681643ffc38eedbd4523dcc"></a><!-- doxytag: member="redEye.cpp::MIN_RED_VAL" ref="ad7ed4710f681643ffc38eedbd4523dcc" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define MIN_RED_VAL 40</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00302">302</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00372">findBlobs()</a>, and <a class="el" href="redEye_8cpp_source.html#l00305">findRegionOfInterest()</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a7a6d47eeb0f1fbac201599af4bda8719"></a><!-- doxytag: member="redEye.cpp::desaturateAlpha" ref="a7a6d47eeb0f1fbac201599af4bda8719" args="(int x, int y)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">double desaturateAlpha </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>y</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00572">572</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#l00561">IDedPixel()</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00612">desaturateBlobs()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00573"></a>00573 { <a name="l00574"></a>00574 <span class="keywordtype">int</span> n = 0; <a name="l00575"></a>00575 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x ,y ) ) n++; <a name="l00576"></a>00576 <a name="l00577"></a>00577 <span class="keywordflow">if</span>(n == 1) <a name="l00578"></a>00578 <span class="keywordflow">return</span> 1.0; <a name="l00579"></a>00579 <a name="l00580"></a>00580 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-1,y-1) ) n++; <a name="l00581"></a>00581 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x ,y-1) ) n++; <a name="l00582"></a>00582 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+1,y-1) ) n++; <a name="l00583"></a>00583 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-1,y ) ) n++; <a name="l00584"></a>00584 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+1,y ) ) n++; <a name="l00585"></a>00585 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-1,y+1) ) n++; <a name="l00586"></a>00586 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x ,y+1) ) n++; <a name="l00587"></a>00587 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+1,y+1) ) n++; <a name="l00588"></a>00588 <a name="l00589"></a>00589 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-2,y-2) ) n++; <a name="l00590"></a>00590 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-1,y-2) ) n++; <a name="l00591"></a>00591 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x ,y-2) ) n++; <a name="l00592"></a>00592 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+1,y-2) ) n++; <a name="l00593"></a>00593 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+2,y-2) ) n++; <a name="l00594"></a>00594 <a name="l00595"></a>00595 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-2,y-1) ) n++; <a name="l00596"></a>00596 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+2,y-1) ) n++; <a name="l00597"></a>00597 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-2,y ) ) n++; <a name="l00598"></a>00598 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+2,y ) ) n++; <a name="l00599"></a>00599 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-2,y+1) ) n++; <a name="l00600"></a>00600 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+2,y+1) ) n++; <a name="l00601"></a>00601 <a name="l00602"></a>00602 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-2,y+2) ) n++; <a name="l00603"></a>00603 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x-1,y+2) ) n++; <a name="l00604"></a>00604 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x ,y+2) ) n++; <a name="l00605"></a>00605 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+1,y+2) ) n++; <a name="l00606"></a>00606 <span class="keywordflow">if</span>( <a class="code" href="redEye_8cpp.html#a996bbc1105cce6820c704c4b1174981c">IDedPixel</a>(x+2,y+2) ) n++; <a name="l00607"></a>00607 <a name="l00608"></a>00608 <a name="l00609"></a>00609 <span class="keywordflow">return</span> ((<span class="keywordtype">double</span>)n) / 25; <a name="l00610"></a>00610 } </pre></div></p> </div> </div> <a class="anchor" id="a58dd38d7509fe0a51a8f364190018018"></a><!-- doxytag: member="redEye.cpp::desaturateBlobs" ref="a58dd38d7509fe0a51a8f364190018018" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void desaturateBlobs </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00612">612</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>References <a class="el" href="redEye__internal_8h_source.html#l00042">bottomRight</a>, <a class="el" href="redEye_8cpp_source.html#l00572">desaturateAlpha()</a>, <a class="el" href="redEye__internal_8h_source.html#l00037">editedImage</a>, and <a class="el" href="redEye__internal_8h_source.html#l00042">topLeft</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00206">removeRedeyeRegions()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00613"></a>00613 { <a name="l00614"></a>00614 <span class="comment">//desaturate bad pixels</span> <a name="l00615"></a>00615 <span class="keywordtype">int</span> x, y; <a name="l00616"></a>00616 <span class="keywordtype">double</span> r; <a name="l00617"></a>00617 QRgb* rgb; <a name="l00618"></a>00618 uchar* scanLine; <a name="l00619"></a>00619 <span class="keywordflow">for</span>( y = QMAX( <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y()-1, 0); <a name="l00620"></a>00620 y<= QMIN( <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.y()+1, <a class="code" href="redEye__internal_8h.html#a63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>->height()-1 ); <a name="l00621"></a>00621 y++) <a name="l00622"></a>00622 { <a name="l00623"></a>00623 scanLine = <a class="code" href="redEye__internal_8h.html#a63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>->scanLine(y); <a name="l00624"></a>00624 <span class="keywordflow">for</span>( x = QMAX( <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x()-1, 0); <a name="l00625"></a>00625 x <= QMIN( <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.x()+1, <a class="code" href="redEye__internal_8h.html#a63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>->width()-1 ); <a name="l00626"></a>00626 x++) <a name="l00627"></a>00627 { <a name="l00628"></a>00628 <span class="keywordtype">double</span> alpha = <a class="code" href="redEye_8cpp.html#a7a6d47eeb0f1fbac201599af4bda8719">desaturateAlpha</a>( x, y ); <a name="l00629"></a>00629 <span class="keywordflow">if</span>( alpha > 0) <a name="l00630"></a>00630 { <a name="l00631"></a>00631 rgb = ((QRgb*)scanLine+x); <a name="l00632"></a>00632 <a name="l00633"></a>00633 r = alpha*(0.05*qRed(*rgb) + 0.6*qGreen(*rgb) + 0.3*qBlue(*rgb)) + <a name="l00634"></a>00634 (1-alpha)*qRed(*rgb); <a name="l00635"></a>00635 *rgb = qRgb( (<span class="keywordtype">int</span>)r, <a name="l00636"></a>00636 qGreen(*rgb), <a name="l00637"></a>00637 qBlue(*rgb) ); <a name="l00638"></a>00638 } <span class="comment">//alpha > 0</span> <a name="l00639"></a>00639 } <span class="comment">//x</span> <a name="l00640"></a>00640 } <span class="comment">//y </span> <a name="l00641"></a>00641 } </pre></div></p> </div> </div> <a class="anchor" id="af4dcda43e955d647a9c8e1f00056a41c"></a><!-- doxytag: member="redEye.cpp::desaturateEntireImage" ref="af4dcda43e955d647a9c8e1f00056a41c" args="(QPoint topLeftExtreme, QPoint bottomRightExtreme)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void desaturateEntireImage </td> <td>(</td> <td class="paramtype">QPoint </td> <td class="paramname"> <em>topLeftExtreme</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">QPoint </td> <td class="paramname"> <em>bottomRightExtreme</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00643">643</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>References <a class="el" href="redEye__internal_8h_source.html#l00037">editedImage</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00206">removeRedeyeRegions()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00644"></a>00644 { <a name="l00645"></a>00645 <span class="comment">//desaturate bad pixels</span> <a name="l00646"></a>00646 <span class="keywordtype">int</span> x, y; <a name="l00647"></a>00647 QRgb* rgb; <a name="l00648"></a>00648 uchar* scanLine; <a name="l00649"></a>00649 <span class="keywordflow">for</span>( y=topLeftExtreme.y(); y<=bottomRightExtreme.y(); y++) <a name="l00650"></a>00650 { <a name="l00651"></a>00651 scanLine = <a class="code" href="redEye__internal_8h.html#a63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>->scanLine(y); <a name="l00652"></a>00652 <span class="keywordflow">for</span>( x=topLeftExtreme.x(); x<=bottomRightExtreme.x(); x++) <a name="l00653"></a>00653 { <a name="l00654"></a>00654 rgb = ((QRgb*)scanLine+x); <a name="l00655"></a>00655 <span class="keywordflow">if</span>( qRed(*rgb) > 2*qGreen(*rgb) ) <a name="l00656"></a>00656 { <a name="l00657"></a>00657 *rgb = qRgb( (<span class="keywordtype">int</span>) (0.05*qRed(*rgb) + 0.6*qGreen(*rgb) + 0.3*qBlue(*rgb)), <a name="l00658"></a>00658 qGreen(*rgb), <a name="l00659"></a>00659 qBlue(*rgb) ); <a name="l00660"></a>00660 } <span class="comment">// > thresh</span> <a name="l00661"></a>00661 } <span class="comment">//x</span> <a name="l00662"></a>00662 } <span class="comment">//y</span> <a name="l00663"></a>00663 } </pre></div></p> </div> </div> <a class="anchor" id="a7f1ea49f9377698b39bbe4c95d3dfacf"></a><!-- doxytag: member="redEye.cpp::findBestTwoBlobs" ref="a7f1ea49f9377698b39bbe4c95d3dfacf" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void findBestTwoBlobs </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00506">506</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>References <a class="el" href="redEye__internal_8h_source.html#l00063">blobCount</a>, <a class="el" href="redEye__internal_8h_source.html#l00071">id1</a>, <a class="el" href="redEye__internal_8h_source.html#l00071">id2</a>, <a class="el" href="redEye__internal_8h_source.html#l00064">ids</a>, <a class="el" href="redEye__internal_8h_source.html#l00066">ratios</a>, and <a class="el" href="redEye__internal_8h_source.html#l00065">sizes</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00206">removeRedeyeRegions()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00507"></a>00507 { <a name="l00508"></a>00508 <a class="code" href="redEye__internal_8h.html#a0c133898e18cb9e8871148f231b91499">id1</a> = -1; <a name="l00509"></a>00509 <a class="code" href="redEye__internal_8h.html#abff687cb542be70b85afa82d0c3496d0">id2</a> = -1; <a name="l00510"></a>00510 <span class="keywordtype">int</span> i; <a name="l00511"></a>00511 <a name="l00512"></a>00512 <span class="comment">//special case: 2 blobs found, both larger than 1 pixel</span> <a name="l00513"></a>00513 <span class="keywordflow">if</span>(<a class="code" href="redEye__internal_8h.html#aa46d418947b61aba8afc97ea215333a6">blobCount</a> == 2 && <a name="l00514"></a>00514 <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[0] > 1 && <a name="l00515"></a>00515 <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[1] > 1) <a name="l00516"></a>00516 { <a name="l00517"></a>00517 <a class="code" href="redEye__internal_8h.html#a0c133898e18cb9e8871148f231b91499">id1</a> = <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[0]; <a name="l00518"></a>00518 <a class="code" href="redEye__internal_8h.html#abff687cb542be70b85afa82d0c3496d0">id2</a> = <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[1]; <a name="l00519"></a>00519 } <a name="l00520"></a>00520 <span class="keywordflow">else</span> <a name="l00521"></a>00521 { <a name="l00522"></a>00522 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="redEye__internal_8h.html#aa46d418947b61aba8afc97ea215333a6">blobCount</a>-2; i++) <a name="l00523"></a>00523 { <a name="l00524"></a>00524 <span class="comment">//once we hit blobs that are only one pixel large stop because they are probably just noise</span> <a name="l00525"></a>00525 <span class="keywordflow">if</span>( <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i+1] <= 1 ) <span class="keywordflow">break</span>; <a name="l00526"></a>00526 <a name="l00527"></a>00527 <span class="keywordtype">double</span> as1 = <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i]; <a name="l00528"></a>00528 <span class="keywordtype">double</span> as2 = <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i+1]; <a name="l00529"></a>00529 <a name="l00530"></a>00530 <span class="keywordflow">if</span>(as1 < 1) as1 = 1.0/as1; <a name="l00531"></a>00531 <span class="keywordflow">if</span>(as2 < 1) as2 = 1.0/as2; <a name="l00532"></a>00532 <a name="l00533"></a>00533 <span class="keywordflow">if</span>( <span class="comment">//both blobs must be semi-circular, prefer those that are wider</span> <a name="l00534"></a>00534 <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i] > 0.75 && <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i] < 2 && <a name="l00535"></a>00535 <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i+1] > 0.75 && <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i+1] < 2 && <a name="l00536"></a>00536 <span class="comment">//both blobs must be similar in shape</span> <a name="l00537"></a>00537 QMAX(as2,as1)/QMIN(as2,as1) < 2 && <a name="l00538"></a>00538 <span class="comment">//both blobs must be similar in size</span> <a name="l00539"></a>00539 ((<span class="keywordtype">double</span>)QMAX( <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i], <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i+1] )) / QMIN( <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i], <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i+1] ) < 1.5 && <a name="l00540"></a>00540 <span class="comment">//both blobs must be above a certain thresh size, this prevents selecting blobs that are very very tiny</span> <a name="l00541"></a>00541 <span class="comment">//if only tiny blobs are around we'll end up desaturating entire region</span> <a name="l00542"></a>00542 QMAX( <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i], <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i+1] ) > 20 ) <a name="l00543"></a>00543 { <a name="l00544"></a>00544 <a class="code" href="redEye__internal_8h.html#a0c133898e18cb9e8871148f231b91499">id1</a> = <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[i]; <a name="l00545"></a>00545 <a class="code" href="redEye__internal_8h.html#abff687cb542be70b85afa82d0c3496d0">id2</a> = <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[i+1]; <a name="l00546"></a>00546 <span class="keywordflow">break</span>; <a name="l00547"></a>00547 } <a name="l00548"></a>00548 } <a name="l00549"></a>00549 } <a name="l00550"></a>00550 <a name="l00551"></a>00551 <span class="comment">//Comment this sectionin to see what blobs were found and selected</span> <a name="l00552"></a>00552 <span class="comment">/* cout << "-----\n";</span> <a name="l00553"></a>00553 <span class="comment"> for(i=0; i<blobCount-1; i++)</span> <a name="l00554"></a>00554 <span class="comment"> {</span> <a name="l00555"></a>00555 <span class="comment"> if( ids[i] == id1 || ids[i] == id2 )</span> <a name="l00556"></a>00556 <span class="comment"> cout << "--->";</span> <a name="l00557"></a>00557 <span class="comment"> cout << "ID: " << ids[i] << "count: " << sizes[i] << " w:h: " << ratios[i] << "\n"; </span> <a name="l00558"></a>00558 <span class="comment"> }*/</span> <a name="l00559"></a>00559 } </pre></div></p> </div> </div> <a class="anchor" id="aee8db73b8ae2738abf7e7d45530e2aea"></a><!-- doxytag: member="redEye.cpp::findBlobs" ref="aee8db73b8ae2738abf7e7d45530e2aea" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void findBlobs </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00372">372</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>References <a class="el" href="redEye__internal_8h_source.html#l00058">blobAspectRatios</a>, <a class="el" href="redEye__internal_8h_source.html#l00050">blobBottomRight</a>, <a class="el" href="redEye__internal_8h_source.html#l00056">blobIDs</a>, <a class="el" href="redEye__internal_8h_source.html#l00049">blobPixelCount</a>, <a class="el" href="redEye__internal_8h_source.html#l00057">blobSizes</a>, <a class="el" href="redEye__internal_8h_source.html#l00050">blobTopLeft</a>, <a class="el" href="redEye__internal_8h_source.html#l00042">bottomRight</a>, <a class="el" href="redEye_8cpp_source.html#l00302">MIN_RED_VAL</a>, <a class="el" href="redEye_8cpp_source.html#l00350">pushPixel()</a>, <a class="el" href="redEye__internal_8h_source.html#l00034">rawImage</a>, <a class="el" href="redEye__internal_8h_source.html#l00047">regionHeight</a>, <a class="el" href="redEye__internal_8h_source.html#l00052">regionOfInterest</a>, <a class="el" href="redEye__internal_8h_source.html#l00047">regionWidth</a>, <a class="el" href="redEye__internal_8h_source.html#l00054">spreadablePixels</a>, and <a class="el" href="redEye__internal_8h_source.html#l00042">topLeft</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00206">removeRedeyeRegions()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00373"></a>00373 { <a name="l00374"></a>00374 <span class="comment">//create small matrix for region of interest</span> <a name="l00375"></a>00375 <a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a> = <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.x() - <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x() + 1; <a name="l00376"></a>00376 <a class="code" href="redEye__internal_8h.html#ad61f84d3753db9df2a7ecee3c3323770">regionHeight</a> = <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.y() - <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y() + 1; <a name="l00377"></a>00377 <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a> = <span class="keyword">new</span> <span class="keywordtype">int</span>[ <a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a> * <a class="code" href="redEye__internal_8h.html#ad61f84d3753db9df2a7ecee3c3323770">regionHeight</a> ]; <a name="l00378"></a>00378 <a name="l00379"></a>00379 <span class="comment">//set all pixels that meet thresh to 1, all others to 0</span> <a name="l00380"></a>00380 <span class="keywordtype">int</span> x, y; <a name="l00381"></a>00381 <span class="keywordtype">int</span> x2, y2; <a name="l00382"></a>00382 QRgb* rgb; <a name="l00383"></a>00383 uchar* scanLine; <a name="l00384"></a>00384 <span class="keywordflow">for</span>( y=<a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y(); y<=<a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.y(); y++) <a name="l00385"></a>00385 { <a name="l00386"></a>00386 y2 = y - <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y(); <a name="l00387"></a>00387 <a name="l00388"></a>00388 scanLine = <a class="code" href="redEye__internal_8h.html#a5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.scanLine(y); <a name="l00389"></a>00389 <span class="keywordflow">for</span>( x=<a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x(); x<=<a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.x(); x++) <a name="l00390"></a>00390 { <a name="l00391"></a>00391 <a name="l00392"></a>00392 x2 = x - <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x(); <a name="l00393"></a>00393 <a name="l00394"></a>00394 rgb = ((QRgb*)scanLine+x); <a name="l00395"></a>00395 <a name="l00396"></a>00396 <span class="keywordtype">bool</span> threshMet = qRed(*rgb) > 2*qGreen(*rgb) && <a name="l00397"></a>00397 qRed(*rgb) > <a class="code" href="redEye_8cpp.html#ad7ed4710f681643ffc38eedbd4523dcc">MIN_RED_VAL</a>; <a name="l00398"></a>00398 <a name="l00399"></a>00399 <span class="keywordflow">if</span>(threshMet) <a name="l00400"></a>00400 <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[ x2 + y2*<a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a> ] = 1; <a name="l00401"></a>00401 <span class="keywordflow">else</span> <a name="l00402"></a>00402 <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[ x2 + y2*<a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a> ] = 0; <a name="l00403"></a>00403 } <a name="l00404"></a>00404 } <a name="l00405"></a>00405 <a name="l00406"></a>00406 <span class="comment">//walk over region of interest and propogate blobs</span> <a name="l00407"></a>00407 <span class="keywordtype">int</span> nextValidID = 2; <a name="l00408"></a>00408 <span class="keywordflow">for</span>(x = 0; x<<a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a>; x++) <a name="l00409"></a>00409 { <a name="l00410"></a>00410 <span class="keywordflow">for</span>(y = 0; y<<a class="code" href="redEye__internal_8h.html#ad61f84d3753db9df2a7ecee3c3323770">regionHeight</a>; y++) <a name="l00411"></a>00411 { <a name="l00412"></a>00412 <span class="comment">//if any blobs can be propogated handle them first</span> <a name="l00413"></a>00413 <span class="keywordflow">while</span>( !<a class="code" href="redEye__internal_8h.html#a2c631e95efba7b4f9f3100c70b51dab5">spreadablePixels</a>.empty() ) <a name="l00414"></a>00414 { <a name="l00415"></a>00415 QPoint point = <a class="code" href="redEye__internal_8h.html#a2c631e95efba7b4f9f3100c70b51dab5">spreadablePixels</a>.pop(); <a name="l00416"></a>00416 <span class="keywordtype">int</span> <span class="keywordtype">id</span> = <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[ point.x() + point.y()*regionWidth ]; <a name="l00417"></a>00417 <a name="l00418"></a>00418 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( point.x()-1, point.y()-1, id ); <a name="l00419"></a>00419 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( point.x(), point.y()-1, id ); <a name="l00420"></a>00420 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( point.x()+1, point.y()-1, id ); <a name="l00421"></a>00421 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( point.x()-1, point.y(), id ); <a name="l00422"></a>00422 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( point.x()+1, point.y(), id ); <a name="l00423"></a>00423 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( point.x()-1, point.y()+1, id ); <a name="l00424"></a>00424 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( point.x(), point.y()+1, id ); <a name="l00425"></a>00425 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( point.x()+1, point.y()+1, id ); <a name="l00426"></a>00426 } <a name="l00427"></a>00427 <a name="l00428"></a>00428 <span class="comment">//if this pixel has met thresh and has not yet been assigned a unique ID,</span> <a name="l00429"></a>00429 <span class="comment">//assign it the next unique id and push all valid neighbors</span> <a name="l00430"></a>00430 <span class="keywordflow">if</span>( <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[ x + y*regionWidth ] == 1 ) <a name="l00431"></a>00431 { <a name="l00432"></a>00432 <span class="comment">//print last blob stats</span> <a name="l00433"></a>00433 <span class="keywordflow">if</span>( nextValidID > 2) <a name="l00434"></a>00434 { <a name="l00435"></a>00435 <a class="code" href="redEye__internal_8h.html#af55dfde32d7c01326d7fba53fc627296">blobIDs</a>.push( (nextValidID - 1) ); <a name="l00436"></a>00436 <a class="code" href="redEye__internal_8h.html#a9da65c9567b26aa798fbd74c220a6322">blobSizes</a>.push( <a class="code" href="redEye__internal_8h.html#a9ca3db90b1887965fb41c967436c63d8">blobPixelCount</a> ); <a name="l00437"></a>00437 <a class="code" href="redEye__internal_8h.html#a4e2f76562964b5c6e1224f547cff0be7">blobAspectRatios</a>.push( ((<span class="keywordtype">double</span>)(<a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a>.x() - <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a>.x()+1)) / <a name="l00438"></a>00438 (<a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a>.y() - <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a>.y()+1) ); <a name="l00439"></a>00439 } <a name="l00440"></a>00440 <a name="l00441"></a>00441 <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[x + y*regionWidth] = nextValidID; <a name="l00442"></a>00442 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( x-1, y-1, nextValidID ); <a name="l00443"></a>00443 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( x, y-1, nextValidID ); <a name="l00444"></a>00444 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( x+1, y-1, nextValidID ); <a name="l00445"></a>00445 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( x-1, y, nextValidID ); <a name="l00446"></a>00446 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( x+1, y, nextValidID ); <a name="l00447"></a>00447 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( x-1, y+1, nextValidID ); <a name="l00448"></a>00448 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( x, y+1, nextValidID ); <a name="l00449"></a>00449 <a class="code" href="redEye_8cpp.html#a53e8ae2ad8b93ea9947e891d10471862">pushPixel</a>( x+1, y+1, nextValidID ); <a name="l00450"></a>00450 nextValidID++; <a name="l00451"></a>00451 <a name="l00452"></a>00452 <a class="code" href="redEye__internal_8h.html#a9ca3db90b1887965fb41c967436c63d8">blobPixelCount</a> = 1; <a name="l00453"></a>00453 <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a> = QPoint( x, y ); <a name="l00454"></a>00454 <a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a> = QPoint( x, y ); <a name="l00455"></a>00455 } <a name="l00456"></a>00456 } <span class="comment">//y</span> <a name="l00457"></a>00457 } <span class="comment">//x</span> <a name="l00458"></a>00458 <a name="l00459"></a>00459 <span class="comment">//insert last blob stats</span> <a name="l00460"></a>00460 <span class="keywordflow">if</span>( nextValidID > 2) <a name="l00461"></a>00461 { <a name="l00462"></a>00462 <a class="code" href="redEye__internal_8h.html#af55dfde32d7c01326d7fba53fc627296">blobIDs</a>.push( (nextValidID - 1) ); <a name="l00463"></a>00463 <a class="code" href="redEye__internal_8h.html#a9da65c9567b26aa798fbd74c220a6322">blobSizes</a>.push( <a class="code" href="redEye__internal_8h.html#a9ca3db90b1887965fb41c967436c63d8">blobPixelCount</a> ); <a name="l00464"></a>00464 <a class="code" href="redEye__internal_8h.html#a4e2f76562964b5c6e1224f547cff0be7">blobAspectRatios</a>.push( ((<span class="keywordtype">double</span>)(<a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a>.x() - <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a>.x()+1)) / (<a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a>.y() - <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a>.y()+1) ); <a name="l00465"></a>00465 } <a name="l00466"></a>00466 } </pre></div></p> </div> </div> <a class="anchor" id="abf1a28f820dfa8bba3056128a76e2b31"></a><!-- doxytag: member="redEye.cpp::findRegionOfInterest" ref="abf1a28f820dfa8bba3056128a76e2b31" args="(QPoint topLeftExtreme, QPoint bottomRightExtreme)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void findRegionOfInterest </td> <td>(</td> <td class="paramtype">QPoint </td> <td class="paramname"> <em>topLeftExtreme</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">QPoint </td> <td class="paramname"> <em>bottomRightExtreme</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00305">305</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>References <a class="el" href="redEye__internal_8h_source.html#l00042">bottomRight</a>, <a class="el" href="statusWidget_8cpp_source.html#l00119">StatusWidget::incrementProgress()</a>, <a class="el" href="redEye_8cpp_source.html#l00302">MIN_RED_VAL</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="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="redEye_8cpp_source.html#l00206">removeRedeyeRegions()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00306"></a>00306 { <a name="l00307"></a>00307 <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a> = QPoint(-1,-1); <a name="l00308"></a>00308 <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a> = QPoint(-1,-1); <a name="l00309"></a>00309 <a name="l00310"></a>00310 <span class="keywordtype">int</span> x, y; <a name="l00311"></a>00311 QRgb* rgb; <a name="l00312"></a>00312 uchar* scanLine; <a name="l00313"></a>00313 <span class="keywordflow">for</span>( y=topLeftExtreme.y(); y<=bottomRightExtreme.y(); y++) <a name="l00314"></a>00314 { <a name="l00315"></a>00315 scanLine = <a class="code" href="redEye__internal_8h.html#a5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.scanLine(y); <a name="l00316"></a>00316 <span class="keywordflow">for</span>( x=topLeftExtreme.x(); x<=bottomRightExtreme.x(); x++) <a name="l00317"></a>00317 { <a name="l00318"></a>00318 rgb = ((QRgb*)scanLine+x); <a name="l00319"></a>00319 <a name="l00320"></a>00320 <span class="keywordtype">bool</span> threshMet = qRed(*rgb) > 2*qGreen(*rgb) && <a name="l00321"></a>00321 qRed(*rgb) > <a class="code" href="redEye_8cpp.html#ad7ed4710f681643ffc38eedbd4523dcc">MIN_RED_VAL</a>; <a name="l00322"></a>00322 <span class="keywordflow">if</span>(threshMet) <a name="l00323"></a>00323 { <a name="l00324"></a>00324 <span class="comment">//first pixel</span> <a name="l00325"></a>00325 <span class="keywordflow">if</span>(<a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x() == -1) <a name="l00326"></a>00326 { <a name="l00327"></a>00327 <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a> = QPoint(x,y); <a name="l00328"></a>00328 <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a> = QPoint(x,y); <a name="l00329"></a>00329 } <a name="l00330"></a>00330 <a name="l00331"></a>00331 <span class="keywordflow">if</span>(x < <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x() ) <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.setX( x ); <a name="l00332"></a>00332 <span class="keywordflow">if</span>(y < <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y() ) <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.setY( y ); <a name="l00333"></a>00333 <span class="keywordflow">if</span>(x > <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.x() ) <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.setX( x ); <a name="l00334"></a>00334 <span class="keywordflow">if</span>(y > <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.y() ) <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.setY( y ); <a name="l00335"></a>00335 } <a name="l00336"></a>00336 <a name="l00337"></a>00337 <span class="comment">//update status bar if significant progress has been made since last update</span> <a name="l00338"></a>00338 <a class="code" href="redEye__internal_8h.html#acaa08422437cae250a76ca488cbe1567">newProgress</a>++; <a name="l00339"></a>00339 <span class="keywordflow">if</span>(<a class="code" href="redEye__internal_8h.html#acaa08422437cae250a76ca488cbe1567">newProgress</a> >= <a class="code" href="redEye__internal_8h.html#a32598f506d413f48cda8e1c930dae6b3">updateIncrement</a>) <a name="l00340"></a>00340 { <a name="l00341"></a>00341 <a class="code" href="redEye__internal_8h.html#acaa08422437cae250a76ca488cbe1567">newProgress</a> = 0; <a name="l00342"></a>00342 <a class="code" href="redEye__internal_8h.html#a65b682074aef9e63bb1dad48c3e9e9df">status</a>-><a class="code" href="classStatusWidget.html#ade18735223ae40506c32c96b9c9c5476" title="Updates the progress bar by one step.">incrementProgress</a>(); <a name="l00343"></a>00343 qApp->processEvents(); <a name="l00344"></a>00344 } <a name="l00345"></a>00345 <a name="l00346"></a>00346 } <a name="l00347"></a>00347 } <a name="l00348"></a>00348 } </pre></div></p> </div> </div> <a class="anchor" id="a996bbc1105cce6820c704c4b1174981c"></a><!-- doxytag: member="redEye.cpp::IDedPixel" ref="a996bbc1105cce6820c704c4b1174981c" args="(int x, int y)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool IDedPixel </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>y</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00561">561</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>References <a class="el" href="redEye__internal_8h_source.html#l00042">bottomRight</a>, <a class="el" href="redEye__internal_8h_source.html#l00071">id1</a>, <a class="el" href="redEye__internal_8h_source.html#l00071">id2</a>, <a class="el" href="blur_8cpp_source.html#l00227">regionIndex()</a>, <a class="el" href="redEye__internal_8h_source.html#l00052">regionOfInterest</a>, <a class="el" href="redEye__internal_8h_source.html#l00047">regionWidth</a>, and <a class="el" href="redEye__internal_8h_source.html#l00042">topLeft</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00572">desaturateAlpha()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00562"></a>00562 { <a name="l00563"></a>00563 <span class="keywordflow">if</span>( x < <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x() || y < <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y() || <a name="l00564"></a>00564 x > <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.x() || y > <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.y() ) <a name="l00565"></a>00565 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00566"></a>00566 <a name="l00567"></a>00567 <span class="keywordtype">int</span> <a class="code" href="blur_8cpp.html#a66793d4213f628c343f1b318e1026b73">regionIndex</a> = x - <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x() + (y-<a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y())*<a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a>; <a name="l00568"></a>00568 <span class="keywordflow">return</span> ( <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[regionIndex] == <a class="code" href="redEye__internal_8h.html#a0c133898e18cb9e8871148f231b91499">id1</a> || <a name="l00569"></a>00569 <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[regionIndex] == <a class="code" href="redEye__internal_8h.html#abff687cb542be70b85afa82d0c3496d0">id2</a> ); <a name="l00570"></a>00570 } </pre></div></p> </div> </div> <a class="anchor" id="a53e8ae2ad8b93ea9947e891d10471862"></a><!-- doxytag: member="redEye.cpp::pushPixel" ref="a53e8ae2ad8b93ea9947e891d10471862" args="(int x, int y, int id)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void pushPixel </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>id</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00350">350</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>References <a class="el" href="redEye__internal_8h_source.html#l00050">blobBottomRight</a>, <a class="el" href="redEye__internal_8h_source.html#l00049">blobPixelCount</a>, <a class="el" href="redEye__internal_8h_source.html#l00050">blobTopLeft</a>, <a class="el" href="redEye__internal_8h_source.html#l00047">regionHeight</a>, <a class="el" href="redEye__internal_8h_source.html#l00052">regionOfInterest</a>, <a class="el" href="redEye__internal_8h_source.html#l00047">regionWidth</a>, and <a class="el" href="redEye__internal_8h_source.html#l00054">spreadablePixels</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00372">findBlobs()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00351"></a>00351 { <a name="l00352"></a>00352 <span class="comment">//if pixel off image or below thresh ignore push attempt</span> <a name="l00353"></a>00353 <span class="keywordflow">if</span>( x < 0 || <a name="l00354"></a>00354 y < 0 || <a name="l00355"></a>00355 x >= <a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a> || <a name="l00356"></a>00356 y >= <a class="code" href="redEye__internal_8h.html#ad61f84d3753db9df2a7ecee3c3323770">regionHeight</a> || <a name="l00357"></a>00357 <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[ x + y*<a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a> ] != 1 ) <a name="l00358"></a>00358 <span class="keywordflow">return</span>; <a name="l00359"></a>00359 <a name="l00360"></a>00360 <span class="comment">//passes! set id and actually put pixel onto stack</span> <a name="l00361"></a>00361 <a class="code" href="redEye__internal_8h.html#a670ca124358ed2ce8380d0b335dedda1">regionOfInterest</a>[ x + y*<a class="code" href="redEye__internal_8h.html#a0ec7142cbb09aaf2b806440129c0884c">regionWidth</a>] = id; <a name="l00362"></a>00362 <a class="code" href="redEye__internal_8h.html#a2c631e95efba7b4f9f3100c70b51dab5">spreadablePixels</a>.push( QPoint( x, y ) ); <a name="l00363"></a>00363 <a name="l00364"></a>00364 <span class="comment">//increase blob pixel count and update topLeft and bottomRight</span> <a name="l00365"></a>00365 <a class="code" href="redEye__internal_8h.html#a9ca3db90b1887965fb41c967436c63d8">blobPixelCount</a>++; <a name="l00366"></a>00366 <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a>.setX( QMIN( x, <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a>.x() ) ); <a name="l00367"></a>00367 <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a>.setY( QMIN( y, <a class="code" href="redEye__internal_8h.html#a8ab8b83c4822f5950cb6b7c17ce2d740">blobTopLeft</a>.y() ) ); <a name="l00368"></a>00368 <a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a>.setX( QMAX( x, <a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a>.x() ) ); <a name="l00369"></a>00369 <a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a>.setY( QMAX( y, <a class="code" href="redEye__internal_8h.html#ad1ca7aedb85d44e293176769bdfea6c8">blobBottomRight</a>.y() ) ); <a name="l00370"></a>00370 } </pre></div></p> </div> </div> <a class="anchor" id="a08c3ef4b07c510049d36c6b0825d2455"></a><!-- doxytag: member="redEye.cpp::removeRedeyeRegions" ref="a08c3ef4b07c510049d36c6b0825d2455" args="(QString filename, QPoint topLeftExtreme, QPoint bottomRightExtreme, StatusWidget *statusWidget)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">QImage* removeRedeyeRegions </td> <td>(</td> <td class="paramtype">QString </td> <td class="paramname"> <em>filename</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">QPoint </td> <td class="paramname"> <em>topLeftExtreme</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">QPoint </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> * </td> <td class="paramname"> <em>statusWidget</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <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> <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 <a class="code" href="redEye__internal_8h.html#a65b682074aef9e63bb1dad48c3e9e9df">status</a> = 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#a5ff9c5ed4b72841b490d7a3ce1602423">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#a5ff9c5ed4b72841b490d7a3ce1602423">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#a5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.depth() < 32 ) { <a class="code" href="redEye__internal_8h.html#a5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a> = <a class="code" href="redEye__internal_8h.html#a5ff9c5ed4b72841b490d7a3ce1602423">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#a5ff9c5ed4b72841b490d7a3ce1602423">rawImage</a>.width()-1 ) ); <a name="l00226"></a>00226 bottomRightExtreme.setY( QMIN( bottomRightExtreme.y(), <a class="code" href="redEye__internal_8h.html#a5ff9c5ed4b72841b490d7a3ce1602423">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->translate( <span class="stringliteral">"removeRedeyeRegions"</span>, <span class="stringliteral">"Removing Red-Eye:"</span> ); <a name="l00230"></a>00230 <a class="code" href="redEye__internal_8h.html#a65b682074aef9e63bb1dad48c3e9e9df">status</a>-><a class="code" href="classStatusWidget.html#a57d461014070b9d651c36bd157cab9c1" title="Initializes the progress bar.">showProgressBar</a>( statusMessage, 100 ); <a name="l00231"></a>00231 qApp->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#a32598f506d413f48cda8e1c930dae6b3">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#acaa08422437cae250a76ca488cbe1567">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#abf1a28f820dfa8bba3056128a76e2b31">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#a6a9aebec61b1a6732045c187a6156f4f">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 <a class="code" href="redEye__internal_8h.html#a65b682074aef9e63bb1dad48c3e9e9df">status</a>-><a class="code" href="classStatusWidget.html#a02084869ff1c15dab4bc922a49b31808" title="Update message.">setStatus</a>( <span class="stringliteral">""</span> ); <a name="l00247"></a>00247 qApp->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#a63116a8b94b4ed0e99ddcb7f6f3bd919">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#a63116a8b94b4ed0e99ddcb7f6f3bd919">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 <a class="code" href="redEye__internal_8h.html#a65b682074aef9e63bb1dad48c3e9e9df">status</a>-><a class="code" href="classStatusWidget.html#a02084869ff1c15dab4bc922a49b31808" title="Update message.">setStatus</a>( <span class="stringliteral">""</span> ); <a name="l00263"></a>00263 qApp->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#a63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>->depth() < 32 ) <a name="l00270"></a>00270 { <a name="l00271"></a>00271 QImage* tmp = <a class="code" href="redEye__internal_8h.html#a63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>; <a name="l00272"></a>00272 <a class="code" href="redEye__internal_8h.html#a63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a> = <span class="keyword">new</span> QImage( tmp->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#aee8db73b8ae2738abf7e7d45530e2aea">findBlobs</a>(); <a name="l00277"></a>00277 <a class="code" href="redEye_8cpp.html#a3aaacc5ca86e794b9b1eb5cbae4b33c0">sortBlobsByDecreasingSize</a>(); <a name="l00278"></a>00278 <a class="code" href="redEye_8cpp.html#a7f1ea49f9377698b39bbe4c95d3dfacf">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#a0c133898e18cb9e8871148f231b91499">id1</a> != -1) <a name="l00282"></a>00282 { <a name="l00283"></a>00283 <a class="code" href="redEye_8cpp.html#a58dd38d7509fe0a51a8f364190018018">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#af4dcda43e955d647a9c8e1f00056a41c">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 <a class="code" href="redEye__internal_8h.html#a65b682074aef9e63bb1dad48c3e9e9df">status</a>-><a class="code" href="classStatusWidget.html#a02084869ff1c15dab4bc922a49b31808" title="Update message.">setStatus</a>( <span class="stringliteral">""</span> ); <a name="l00293"></a>00293 qApp->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#a63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a>; <a name="l00297"></a>00297 } </pre></div></p> </div> </div> <a class="anchor" id="a3aaacc5ca86e794b9b1eb5cbae4b33c0"></a><!-- doxytag: member="redEye.cpp::sortBlobsByDecreasingSize" ref="a3aaacc5ca86e794b9b1eb5cbae4b33c0" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void sortBlobsByDecreasingSize </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="redEye_8cpp_source.html#l00468">468</a> of file <a class="el" href="redEye_8cpp_source.html">redEye.cpp</a>.</p> <p>References <a class="el" href="redEye__internal_8h_source.html#l00058">blobAspectRatios</a>, <a class="el" href="redEye__internal_8h_source.html#l00063">blobCount</a>, <a class="el" href="redEye__internal_8h_source.html#l00056">blobIDs</a>, <a class="el" href="redEye__internal_8h_source.html#l00057">blobSizes</a>, <a class="el" href="redEye__internal_8h_source.html#l00064">ids</a>, <a class="el" href="redEye__internal_8h_source.html#l00066">ratios</a>, and <a class="el" href="redEye__internal_8h_source.html#l00065">sizes</a>.</p> <p>Referenced by <a class="el" href="redEye_8cpp_source.html#l00206">removeRedeyeRegions()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00469"></a>00469 { <a name="l00470"></a>00470 <a class="code" href="redEye__internal_8h.html#aa46d418947b61aba8afc97ea215333a6">blobCount</a> = <a class="code" href="redEye__internal_8h.html#af55dfde32d7c01326d7fba53fc627296">blobIDs</a>.count(); <a name="l00471"></a>00471 <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a> = <span class="keyword">new</span> <span class="keywordtype">int</span>[<a class="code" href="redEye__internal_8h.html#aa46d418947b61aba8afc97ea215333a6">blobCount</a>]; <a name="l00472"></a>00472 <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a> = <span class="keyword">new</span> <span class="keywordtype">int</span>[<a class="code" href="redEye__internal_8h.html#aa46d418947b61aba8afc97ea215333a6">blobCount</a>]; <a name="l00473"></a>00473 <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a> = <span class="keyword">new</span> <span class="keywordtype">double</span>[<a class="code" href="redEye__internal_8h.html#aa46d418947b61aba8afc97ea215333a6">blobCount</a>]; <a name="l00474"></a>00474 <a name="l00475"></a>00475 <span class="keywordtype">int</span> i,j; <a name="l00476"></a>00476 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="redEye__internal_8h.html#aa46d418947b61aba8afc97ea215333a6">blobCount</a>; i++) <a name="l00477"></a>00477 { <a name="l00478"></a>00478 <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[i] = <a class="code" href="redEye__internal_8h.html#af55dfde32d7c01326d7fba53fc627296">blobIDs</a>.pop(); <a name="l00479"></a>00479 <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i] = <a class="code" href="redEye__internal_8h.html#a9da65c9567b26aa798fbd74c220a6322">blobSizes</a>.pop(); <a name="l00480"></a>00480 <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i] = <a class="code" href="redEye__internal_8h.html#a4e2f76562964b5c6e1224f547cff0be7">blobAspectRatios</a>.pop(); <a name="l00481"></a>00481 } <a name="l00482"></a>00482 <a name="l00483"></a>00483 <span class="comment">//quick and dirty bubble sort</span> <a name="l00484"></a>00484 <span class="keywordflow">for</span>(j = blobCount-1; j>0; j--) <a name="l00485"></a>00485 { <a name="l00486"></a>00486 <span class="keywordflow">for</span>(i=0; i<j; i++) <a name="l00487"></a>00487 { <a name="l00488"></a>00488 <span class="keywordflow">if</span>( <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i+1] > <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i] ) <a name="l00489"></a>00489 { <a name="l00490"></a>00490 <span class="keywordtype">int</span> t = <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i+1]; <a name="l00491"></a>00491 <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i+1] = <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i]; <a name="l00492"></a>00492 <a class="code" href="redEye__internal_8h.html#afcc291f06aa904173ea1ada4741707f6">sizes</a>[i] = t; <a name="l00493"></a>00493 <a name="l00494"></a>00494 t = <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[i+1]; <a name="l00495"></a>00495 <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[i+1] = <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[i]; <a name="l00496"></a>00496 <a class="code" href="redEye__internal_8h.html#a6081d5fc46a8899b4beb60b0df7dd190">ids</a>[i] = t; <a name="l00497"></a>00497 <a name="l00498"></a>00498 <span class="keywordtype">double</span> tR = <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i+1]; <a name="l00499"></a>00499 <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i+1] = <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i]; <a name="l00500"></a>00500 <a class="code" href="redEye__internal_8h.html#a6cb43dbc00001c7da1b1a22be982a58a">ratios</a>[i] = tR; <a name="l00501"></a>00501 } <a name="l00502"></a>00502 } <a name="l00503"></a>00503 } <a name="l00504"></a>00504 } </pre></div></p> </div> </div> </div> <hr size="1"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> </body> </html>