Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

edgeDetect.h

Go to the documentation of this file.
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_MANIPULATIONS_EDGEDETECTOR_H 00012 #define BACKEND_MANIPULATIONS_EDGEDETECTOR_H 00013 00014 //-------------------- 00015 //forward declarations 00016 //-------------------- 00017 class QImage; 00018 00019 //-------------------- 00020 typedef struct 00021 { 00022 float ESF; 00023 int direction; 00024 } LUTentry; 00025 //-------------------- 00026 typedef struct 00027 { 00028 int minLuminance; 00029 int maxLuminance; 00030 00031 int edgeMagHistogram[256]; 00032 float totalEdgeMagnitude; 00033 int numPixels; 00034 00035 //normalized inputs for fuzzy logic process 00036 float meanMode; 00037 float mode; 00038 float pixelCount; 00039 00040 float beta; 00041 float edgeThreshold; 00042 00043 } PixelCluster; 00044 //-------------------- 00045 class EdgeDetect 00046 { 00047 public: 00048 EdgeDetect( QImage* image ); 00049 ~EdgeDetect(); 00050 int getNumClusters(); 00051 PixelCluster* getClusters(); 00052 int* getSmoothHist(); 00053 int* getPeaks(); 00054 QImage* getEdgeImage(); 00055 int* getClusterMap(); 00056 //---------------------- 00057 private: 00058 void allocateAndInitObjects(); 00059 00060 //construct a lookup table indexed by computed GSLC codes for applying N(on) M(aximum) S(uppression) 00061 void constructGSLClut(); 00062 00063 //iterate over each pixel computing luminance values for lum map and update lum histogram 00064 void fillLumMapAndLumHistogram(); 00065 00066 //fill smooth lum histogram using lum histogram 00067 void smoothLumHistogram(); 00068 00069 //compute edge magnitude, and GSLC for each pixel 00070 void computeEdgeMagAndGSLCmaps(); 00071 00072 //get pixel luminance for an abritrary pixel, clamping of coordinates performed automatically 00073 int pixelLum(int x, int y); 00074 00075 //determine pixel clusters using smooth lum histogram 00076 void findPixelClusters(); 00077 00078 //compute cluster stats by iterating over image luminance map 00079 void computeClusterStatistics(); 00080 00081 //compute edge thresholds for each cluster using 18-rule fuzzy logic approach 00082 void computeClusterThresholds(); 00083 00084 //replace image with blurred-normalized edge image 00085 void constructEdgeImage(); 00086 00087 void deallocateObjects(); 00088 //---------------------- 00089 //GSLC LUT table 00090 LUTentry LUT[256]; 00091 00092 //loaded image 00093 QImage* image; 00094 00096 int lumHist[256]; 00097 int smoothLumHist[256]; 00098 00099 //cluster peaks 00100 int clusterPeaks[256]; 00101 00102 //luminance map 00103 int* lumMap; 00104 00105 //edge magnitude map 00106 float* edgeMagMap; 00107 00108 //GSLC map 00109 int* GSLCmap; 00110 00111 //pixel clusters 00112 int numClusters; 00113 PixelCluster* clusters; 00114 00115 //min and max # of pixels in clusters 00116 int minClusterSize, maxClusterSize; 00117 //---------------------- 00118 }; 00119 //====================== 00120 00121 #endif //BACKEND_MANIPULATIONS_EDGEDETECTOR_H

Generated on Sun Mar 4 19:42:55 2007 for AlbumShaper by doxygen 1.3.7