00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef BACKEND_MANIPULATIONS_EDGEDETECTOR_H
00012 #define BACKEND_MANIPULATIONS_EDGEDETECTOR_H
00013
00014
00015
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
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
00061 void constructGSLClut();
00062
00063
00064 void fillLumMapAndLumHistogram();
00065
00066
00067 void smoothLumHistogram();
00068
00069
00070 void computeEdgeMagAndGSLCmaps();
00071
00072
00073 int pixelLum(int x, int y);
00074
00075
00076 void findPixelClusters();
00077
00078
00079 void computeClusterStatistics();
00080
00081
00082 void computeClusterThresholds();
00083
00084
00085 void constructEdgeImage();
00086
00087 void deallocateObjects();
00088
00089
00090 LUTentry LUT[256];
00091
00092
00093 QImage* image;
00094
00096 int lumHist[256];
00097 int smoothLumHist[256];
00098
00099
00100 int clusterPeaks[256];
00101
00102
00103 int* lumMap;
00104
00105
00106 float* edgeMagMap;
00107
00108
00109 int* GSLCmap;
00110
00111
00112 int numClusters;
00113 PixelCluster* clusters;
00114
00115
00116 int minClusterSize, maxClusterSize;
00117
00118 };
00119
00120
00121 #endif //BACKEND_MANIPULATIONS_EDGEDETECTOR_H