14 #include <qapplication.h> 19 #include "../../gui/statusWidget.h" 207 QPoint topLeftExtreme, QPoint bottomRightExtreme,
217 if(
rawImage.isNull()) {
return NULL; }
223 topLeftExtreme.setX( QMAX( topLeftExtreme.x(), 0 ) );
224 topLeftExtreme.setY( QMAX( topLeftExtreme.y(), 0 ) );
225 bottomRightExtreme.setX( QMIN( bottomRightExtreme.x(),
rawImage.width()-1 ) );
226 bottomRightExtreme.setY( QMIN( bottomRightExtreme.y(),
rawImage.height()-1 ) );
229 QString statusMessage = qApp->translate(
"removeRedeyeRegions",
"Removing Red-Eye:" );
231 qApp->processEvents();
235 ( bottomRightExtreme.x() - topLeftExtreme.x() + 1 ) *
236 ( bottomRightExtreme.y() - topLeftExtreme.y() + 1 ) );
247 qApp->processEvents();
263 qApp->processEvents();
272 editedImage =
new QImage( tmp->convertDepth( 32, Qt::AutoColor ) );
273 delete tmp; tmp=NULL;
293 qApp->processEvents();
302 #define MIN_RED_VAL 40 313 for( y=topLeftExtreme.y(); y<=bottomRightExtreme.y(); y++)
316 for( x=topLeftExtreme.x(); x<=bottomRightExtreme.x(); x++)
318 rgb = ((QRgb*)scanLine+x);
320 bool threshMet = qRed(*rgb) > 2*qGreen(*rgb) &&
343 qApp->processEvents();
394 rgb = ((QRgb*)scanLine+x);
396 bool threshMet = qRed(*rgb) > 2*qGreen(*rgb) &&
418 pushPixel( point.x()-1, point.y()-1, id );
420 pushPixel( point.x()+1, point.y()-1, id );
423 pushPixel( point.x()-1, point.y()+1, id );
425 pushPixel( point.x()+1, point.y()+1, id );
435 blobIDs.push( (nextValidID - 1) );
462 blobIDs.push( (nextValidID - 1) );
484 for(j = blobCount-1; j>0; j--)
525 if(
sizes[i+1] <= 1 )
break;
530 if(as1 < 1) as1 = 1.0/as1;
531 if(as2 < 1) as2 = 1.0/as2;
537 QMAX(as2,as1)/QMIN(as2,as1) < 2 &&
609 return ((
double)n) / 25;
619 for( y = QMAX(
topLeft.y()-1, 0);
624 for( x = QMAX(
topLeft.x()-1, 0);
631 rgb = ((QRgb*)scanLine+x);
633 r = alpha*(0.05*qRed(*rgb) + 0.6*qGreen(*rgb) + 0.3*qBlue(*rgb)) +
634 (1-alpha)*qRed(*rgb);
649 for( y=topLeftExtreme.y(); y<=bottomRightExtreme.y(); y++)
652 for( x=topLeftExtreme.x(); x<=bottomRightExtreme.x(); x++)
654 rgb = ((QRgb*)scanLine+x);
655 if( qRed(*rgb) > 2*qGreen(*rgb) )
657 *rgb = qRgb( (
int) (0.05*qRed(*rgb) + 0.6*qGreen(*rgb) + 0.3*qBlue(*rgb)),
Q3ValueStack< double > blobAspectRatios
Q3ValueStack< int > blobIDs
int regionIndex(int x, int y)
Q3ValueStack< QPoint > spreadablePixels
double desaturateAlpha(int x, int y)
void findRegionOfInterest(QPoint topLeftExtreme, QPoint bottomRightExtreme)
void pushPixel(int x, int y, int id)
QImage * removeRedeyeRegions(QString filename, QPoint topLeftExtreme, QPoint bottomRightExtreme, StatusWidget *statusWidget)
Q3ValueStack< int > blobSizes
void sortBlobsByDecreasingSize()
bool IDedPixel(int x, int y)
void desaturateEntireImage(QPoint topLeftExtreme, QPoint bottomRightExtreme)