AlbumShaper 1.0a3
edgeDetect.h
Go to the documentation of this file.
1//==============================================
2// copyright : (C) 2003-2005 by Will Stokes
3//==============================================
4// This program is free software; you can redistribute it
5// and/or modify it under the terms of the GNU General
6// Public License as published by the Free Software
7// Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//==============================================
10
11#ifndef BACKEND_MANIPULATIONS_EDGEDETECTOR_H
12#define BACKEND_MANIPULATIONS_EDGEDETECTOR_H
13
14//--------------------
15//forward declarations
16//--------------------
17class QImage;
18
19//--------------------
20typedef struct
21{
22 float ESF;
24} LUTentry;
25//--------------------
26typedef struct
27{
30
31 int edgeMagHistogram[256];
34
35 //normalized inputs for fuzzy logic process
36 float meanMode;
37 float mode;
39
40 float beta;
42
44//--------------------
46{
47public:
48 EdgeDetect( QImage* image );
49 ~EdgeDetect();
50 int getNumClusters();
52 int* getSmoothHist();
53 int* getPeaks();
54 QImage* getEdgeImage();
55 int* getClusterMap();
56 //----------------------
57private:
59
60 //construct a lookup table indexed by computed GSLC codes for applying N(on) M(aximum) S(uppression)
61 void constructGSLClut();
62
63 //iterate over each pixel computing luminance values for lum map and update lum histogram
65
66 //fill smooth lum histogram using lum histogram
67 void smoothLumHistogram();
68
69 //compute edge magnitude, and GSLC for each pixel
71
72 //get pixel luminance for an abritrary pixel, clamping of coordinates performed automatically
73 int pixelLum(int x, int y);
74
75 //determine pixel clusters using smooth lum histogram
76 void findPixelClusters();
77
78 //compute cluster stats by iterating over image luminance map
80
81 //compute edge thresholds for each cluster using 18-rule fuzzy logic approach
83
84 //replace image with blurred-normalized edge image
85 void constructEdgeImage();
86
87 void deallocateObjects();
88 //----------------------
89 //GSLC LUT table
91
92 //loaded image
93 QImage* image;
94
96 int lumHist[256];
97 int smoothLumHist[256];
98
99 //cluster peaks
100 int clusterPeaks[256];
101
102 //luminance map
103 int* lumMap;
104
105 //edge magnitude map
107
108 //GSLC map
109 int* GSLCmap;
110
111 //pixel clusters
114
115 //min and max # of pixels in clusters
117//----------------------
118};
119//======================
120
121#endif //BACKEND_MANIPULATIONS_EDGEDETECTOR_H
void fillLumMapAndLumHistogram()
int * lumMap
Definition edgeDetect.h:103
void allocateAndInitObjects()
PixelCluster * clusters
Definition edgeDetect.h:113
int * getPeaks()
void computeClusterStatistics()
int smoothLumHist[256]
Definition edgeDetect.h:97
void computeClusterThresholds()
void findPixelClusters()
int getNumClusters()
QImage * image
Definition edgeDetect.h:93
void deallocateObjects()
int clusterPeaks[256]
Definition edgeDetect.h:100
void constructEdgeImage()
int * getSmoothHist()
LUTentry LUT[256]
Definition edgeDetect.h:90
int minClusterSize
Definition edgeDetect.h:116
EdgeDetect(QImage *image)
PixelCluster * getClusters()
QImage * getEdgeImage()
void constructGSLClut()
int maxClusterSize
Definition edgeDetect.h:116
int numClusters
Definition edgeDetect.h:112
void computeEdgeMagAndGSLCmaps()
void smoothLumHistogram()
int * getClusterMap()
int lumHist[256]
luminosity and smooth luminosity histograms
Definition edgeDetect.h:96
float * edgeMagMap
Definition edgeDetect.h:106
int * GSLCmap
Definition edgeDetect.h:109
int pixelLum(int x, int y)
float ESF
Definition edgeDetect.h:22
int direction
Definition edgeDetect.h:23
float totalEdgeMagnitude
Definition edgeDetect.h:32
float edgeThreshold
Definition edgeDetect.h:41
float meanMode
Definition edgeDetect.h:36
float pixelCount
Definition edgeDetect.h:38