00001 #ifndef __MicroEdgeMap_H__ 00002 #define __MicroEdgeMap_H__ 00003 00004 #include "Edge.h" 00005 #include "Rasterizer.h" 00006 #include "MicroEdgeDetector.h" 00007 #include "Rectangle.h" 00008 #include "Vector2.h" 00009 00010 #include <vector> 00011 00012 using namespace std; 00013 00014 namespace EdgeDetection 00015 { 00016 // Finds the errors made on two-dimensional edge detection. 00017 class MicroEdgeMap 00018 { 00019 class Entry 00020 { 00021 private: Edge realEdge; 00022 private: Edge measuredEdge; 00023 00024 public: Edge GetRealEdge() { return realEdge; } 00025 public: Edge GetMeasuredEdge() { return measuredEdge; } 00026 00027 public: Entry(Edge realEdge, Edge measuredEdge) 00028 { 00029 this->realEdge = realEdge; 00030 this->measuredEdge = measuredEdge; 00031 } 00032 public: ~Entry() { } 00033 }; 00034 00035 private: Rasterizer* rasterizer; 00036 private: MicroEdgeDetector* microEdgeDetector; 00037 private: vector<Entry> entries; 00038 00039 public: MicroEdgeMap(Rasterizer* rasterizer, MicroEdgeDetector* microEdgeDetector, Rectangle area, int offsetCount, int angleCount) 00040 { 00041 if (rasterizer == 0) throw "The parameter 'rasterizer' cannot be NULL."; 00042 if (microEdgeDetector == 0) throw "The parameter 'microEdgeDetector' cannot be NULL."; 00043 00044 this->rasterizer = rasterizer; 00045 this->microEdgeDetector = microEdgeDetector; 00046 this->entries = vector<Entry>(); 00047 00048 PopulateTable(area, offsetCount, angleCount); 00049 } 00050 public: ~MicroEdgeMap() { } 00051 00052 public: Edge FindRealEdge(Edge measuredEdge); 00053 00054 private: void PopulateTable(Rectangle area, int offsetCount, int angleCount); 00055 private: Edge MeasureEdge(Edge realEdge); 00056 }; 00057 }; 00058 00059 #endif