AlbumShaper
1.0a3
|
00001 //============================================== 00002 // copyright : (C) 2003-2005 by Will Stokes 00003 //============================================== 00004 // This program is free software; you can redistribute it 00005 // and/or modify it under the terms of the GNU General 00006 // Public License as published by the Free Software 00007 // Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 //============================================== 00010 00011 #ifndef BACKEND_ENHANCEMENTS_REDEYE_INTERNAL_H 00012 #define BACKEND_ENHANCEMENTS_REDEYE_INTERNAL_H 00013 00014 #include <qimage.h> 00015 #include <qvaluestack.h> 00016 #include <qpoint.h> 00017 00018 //-------------------- 00019 //forward declarations 00020 //-------------------- 00021 class StatusWidget; 00022 00023 //------ 00024 //handle on status widget 00025 StatusWidget* status; 00026 00027 //update increment variable used to determine when progress bar should be updated 00028 int updateIncrement; 00029 00030 //progress tracker, used to determine when to update the progress bar 00031 int newProgress; 00032 00033 //original image 00034 QImage rawImage; 00035 00036 //modified image 00037 QImage* editedImage; 00038 //------ 00039 //find region within image that blob pixels are within 00040 void findRegionOfInterest(QPoint topLeftExtreme, QPoint bottomRightExtreme); 00041 00042 QPoint topLeft, bottomRight; 00043 //------- 00044 //find all blobs, including their size (pixel count) and width/height aspect ratio 00045 void findBlobs(); 00046 00047 int regionWidth, regionHeight; 00048 00049 int blobPixelCount; 00050 QPoint blobTopLeft, blobBottomRight; 00051 00052 int* regionOfInterest; 00053 void pushPixel(int x, int y, int id); 00054 QValueStack<QPoint> spreadablePixels; 00055 00056 QValueStack<int> blobIDs; 00057 QValueStack<int> blobSizes; 00058 QValueStack<double> blobAspectRatios; 00059 //------- 00060 //sort blob list by decreasing size (pixel count) 00061 void sortBlobsByDecreasingSize(); 00062 00063 int blobCount; 00064 int* ids; 00065 int* sizes; 00066 double* ratios; 00067 //------- 00068 //find biggest two consecutive blobs with similar aspect ratios 00069 void findBestTwoBlobs(); 00070 00071 int id1, id2; 00072 //------- 00073 //desaturate selected blobs 00074 void desaturateBlobs(); 00075 00076 //desaturate entire image - only used if no two good blobs found 00077 void desaturateEntireImage(QPoint topLeftExtreme, QPoint bottomRightExtreme); 00078 00079 bool IDedPixel( int x, int y); 00080 double desaturateAlpha(int x, int y); 00081 //------ 00082 00083 #endif //BACKEND_ENHANCEMENTS_REDEYE_INTERNAL_H