Go to the documentation of this file.00001 #ifndef __MicroEdgeDetector_H__
00002 #define __MicroEdgeDetector_H__
00003
00004 #include "Image.h"
00005 #include "Rasterizer.h"
00006 #include "Edge.h"
00007 #include "MomentMask.h"
00008
00009 namespace EdgeDetection
00010 {
00011
00012 class MicroEdgeDetector
00013 {
00014 private: int size;
00015 private: Image* mask00;
00016 private: Image* mask10;
00017 private: Image* mask01;
00018 private: Image* mask11;
00019 private: Image* mask20;
00020 private: Image* mask02;
00021
00022 public: int GetSize() { return size; }
00023
00024 public: MicroEdgeDetector(Rasterizer* rasterizer, int size)
00025 {
00026 if (rasterizer == 0) throw "The parameter 'rasterizer' cannot be NULL.";
00027 if (size < 0) throw "The parameter 'size' was out of range.";
00028
00029 this->size = size;
00030
00031 MomentMask* mask;
00032
00033 mask = new MomentMask(0, 0);
00034 this->mask00 = rasterizer->Rasterize(mask, size, size);
00035 delete mask;
00036 mask = new MomentMask(1, 0);
00037 this->mask10 = rasterizer->Rasterize(mask, size, size);
00038 delete mask;
00039 mask = new MomentMask(0, 1);
00040 this->mask01 = rasterizer->Rasterize(mask, size, size);
00041 delete mask;
00042 mask = new MomentMask(1, 1);
00043 this->mask11 = rasterizer->Rasterize(mask, size, size);
00044 delete mask;
00045 mask = new MomentMask(2, 0);
00046 this->mask20 = rasterizer->Rasterize(mask, size, size);
00047 delete mask;
00048 mask = new MomentMask(0, 2);
00049 this->mask02 = rasterizer->Rasterize(mask, size, size);
00050 delete mask;
00051 }
00052 public: ~MicroEdgeDetector()
00053 {
00054 delete this->mask00;
00055 delete this->mask10;
00056 delete this->mask01;
00057 delete this->mask11;
00058 delete this->mask20;
00059 delete this->mask02;
00060 }
00061
00062 public: Edge DetectEdge(Image* image);
00063 };
00064 };
00065
00066 #endif