DLCannyEdgeDetect.h

Go to the documentation of this file.
00001 #ifndef _DLCANNYEDGEDETECT_H_
00002 #define _DLCANNYEDGEDETECT_H_
00003 
00004 #include "DLImage.h"
00005 #include "DLBitsPerPixelConverter.h"
00006 #include "DLConst.h"
00007 #include "DLTypes.h"
00008 
00009 #include <math.h>
00010 #include <stdio.h>
00011 
00012 using namespace std;
00013 
00015 #define MAGNITUDE_SCALE 7.0
00016 #define ORIENTATION_SCALE 40.0
00017 #define MAX_RECURSION 200
00018 
00020 #define STANDARD_DEVIATION 1.0
00021 #define PI 3.1415927
00022 
00043 class DLCannyEdgeDetect
00044 {
00045 public:
00046 
00050         DLCannyEdgeDetect();
00051 
00060         DLCannyEdgeDetect(const DLImage& image, DL_BYTE lowT=1, DL_BYTE highT=255);
00061 
00065         virtual ~DLCannyEdgeDetect();
00066 
00071         DLImage dlGetMagnitudeImage();
00072 
00077         DLImage dlGetOrientationImage();
00078 
00079 private:
00080 
00082         int rows;
00083 
00085         int cols;
00086 
00087         int recCounter;
00088 
00091         DL_BYTE *data;
00092     
00094     DL_BYTE *magnitude;
00095 
00097         DL_BYTE *orientation;
00098 
00105         void dlDetectEdge(float s, DL_BYTE lowT, DL_BYTE highT);
00106 
00115         void trackEdgeThreshold(DL_BYTE lowT, DL_BYTE highT);
00116 
00125     bool followEdge(int i, int j, DL_BYTE lowT);
00126 
00133         float hypotenuse(float x, float y)
00134         {
00135                 if (x==0.0 && y==0.0) 
00136                         return 0.0;
00137                 else
00138                         return (float)(hypot(x,y));
00139         };
00140 
00147         float gaussianDistribution(float x, float s) { return exp((-x*x)/(2*s*s)); };
00148         
00149 };//end class
00150 
00151 #endif //_DLCANNYEDGEDETECT_H_

DLCannyEdgeDetectDOCLIB is an add-on module of DOCLIB. DOCLIB is being developed under contract by a collaboration between:

The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007