00001 #ifndef __MacroEdgeDetector_H__ 00002 #define __MacroEdgeDetector_H__ 00003 00004 #include "MicroEdgeDetector.h" 00005 #include "MicroEdgeCorrectionTable.h" 00006 #include "PointCorrector.h" 00007 #include "Image.h" 00008 #include "Line.h" 00009 #include "BoundedLine.h" 00010 #include "Vector2.h" 00011 00012 #include <cmath> 00013 00014 namespace EdgeDetection 00015 { 00016 // Detects two-dimensional macro edges. 00017 class MacroEdgeDetector 00018 { 00019 private: MicroEdgeDetector* microEdgeDetector; 00020 private: MicroEdgeCorrectionTable* microEdgeCorrectionTable; 00021 private: PointCorrector* pointCorrector; 00022 00023 public: MacroEdgeDetector(MicroEdgeDetector* microEdgeDetector, MicroEdgeCorrectionTable* microEdgeCorrectionTable, PointCorrector* pointCorrector) 00024 { 00025 if (microEdgeDetector == 0) throw "The parameter 'microEdgeDetector' cannot be NULL."; 00026 if (microEdgeCorrectionTable == 0) throw "The parameter 'microEdgeCorrectionTable' cannot be NULL."; 00027 if (pointCorrector == 0) throw "The parameter 'pointCorrector' cannot be NULL."; 00028 00029 this->microEdgeDetector = microEdgeDetector; 00030 this->microEdgeCorrectionTable = microEdgeCorrectionTable; 00031 this->pointCorrector = pointCorrector; 00032 } 00033 public: ~MacroEdgeDetector() { } 00034 00035 public: Line DetectEdge(Image* image, BoundedLine estimatedEdge); 00036 00037 private: static int Round(double value) 00038 { 00039 return value >= 0 ? ceil(value - 0.5) : floor(value + 0.5); 00040 } 00041 }; 00042 }; 00043 00044 #endif