00209 {
00210
00211
status = statusWidget;
00212
00213
00214
rawImage = QImage( filename );
00215
00216
00217
if(
rawImage.isNull()) {
return NULL; }
00218
00219
00220
if(
rawImage.depth() < 32 ) {
rawImage =
rawImage.convertDepth( 32, Qt::AutoColor ); }
00221
00222
00223 topLeftExtreme.setX( QMAX( topLeftExtreme.x(), 0 ) );
00224 topLeftExtreme.setY( QMAX( topLeftExtreme.y(), 0 ) );
00225 bottomRightExtreme.setX( QMIN( bottomRightExtreme.x(),
rawImage.width()-1 ) );
00226 bottomRightExtreme.setY( QMIN( bottomRightExtreme.y(),
rawImage.height()-1 ) );
00227
00228
00229 QString statusMessage = qApp->translate(
"removeRedeyeRegions",
"Removing Red-Eye:" );
00230
status->
showProgressBar( statusMessage, 100 );
00231 qApp->processEvents();
00232
00233
00234
updateIncrement = (
int) ( 0.01 *
00235 ( bottomRightExtreme.x() - topLeftExtreme.x() + 1 ) *
00236 ( bottomRightExtreme.y() - topLeftExtreme.y() + 1 ) );
00237
newProgress = 0;
00238
00239
00240
findRegionOfInterest(topLeftExtreme, bottomRightExtreme);
00241
00242
00243
if(
topLeft.x() == -1)
00244 {
00245
00246
status->
setStatus(
"" );
00247 qApp->processEvents();
00248
00249
return NULL;
00250 }
00251
00252
00253
00254
00255
00256
editedImage =
new QImage( filename );
00257
00258
00259
if(
editedImage == NULL)
00260 {
00261
00262
status->
setStatus(
"" );
00263 qApp->processEvents();
00264
00265
return NULL;
00266 }
00267
00268
00269
if(
editedImage->depth() < 32 )
00270 {
00271 QImage* tmp =
editedImage;
00272
editedImage =
new QImage( tmp->convertDepth( 32, Qt::AutoColor ) );
00273
delete tmp; tmp=NULL;
00274 }
00275
00276
findBlobs();
00277
sortBlobsByDecreasingSize();
00278
findBestTwoBlobs();
00279
00280
00281
if(
id1 != -1)
00282 {
00283
desaturateBlobs();
00284 }
00285
00286
else
00287 {
00288
desaturateEntireImage(topLeftExtreme, bottomRightExtreme);
00289 }
00290
00291
00292
status->
setStatus(
"" );
00293 qApp->processEvents();
00294
00295
00296
return editedImage;
00297 }