LineMatching.H
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 #ifndef LineMatching_H_DEFINED
00039 #define LineMatching_H_DEFINED
00040 
00041 #include "Image/Image.H"
00042 #include "Image/ImageSet.H"
00043 #include "Image/Pixels.H"
00044 #include "Image/Layout.H"
00045 #include "plugins/SceneUnderstanding/LineFitting.H"
00046 #include "plugins/SceneUnderstanding/V2.H"
00047 #include "plugins/SceneUnderstanding/LMLineMatcher/LMLineMatcher.h"
00048 
00049 #include "Simulation/SimEvents.H"
00050 #include "Simulation/SimModule.H"
00051 
00052 #include <limits>
00053 #include <vector>
00054 #include <string>
00055 #include <stack>
00056 #include <list>
00057 #include <map>
00058 
00059 class LineMatching : public SimModule
00060 {
00061 public:
00062 
00063 
00064   struct Shape2D
00065   {
00066     std::string name;
00067     double score;
00068     Rectangle bb;
00069     std::vector<Point2D<int> > polygon;
00070 
00071     Shape2D(std::string n, double s, Rectangle b, std::vector<Point2D<int> > p) :
00072       name(n),
00073       score(s),
00074       bb(b),
00075       polygon(p)
00076     {}
00077   };
00078 
00079   LineMatching(OptionManager& mgr, const std::string& descrName = "LineMatching",
00080       const std::string& tagName = "LineMatching");
00081 
00082 
00083   ~LineMatching();
00084 
00085   void evolve(SimEventQueue& q);
00086   Layout<PixRGB<byte> > getDebugImage();
00087 
00088 protected:
00089 
00090   SIMCALLBACK_DECLARE(LineMatching, SimEventV2Output);
00091 
00092 
00093   SIMCALLBACK_DECLARE(LineMatching, SimEventSaveOutput);
00094 
00095 
00096   OModelParam<bool> itsShowDebug;
00097 
00098 
00099 private:
00100   std::vector<V2::LineSegment> itsLines;
00101   Image<PixRGB<byte> > itsInImage;
00102   std::vector<Shape2D> itsShapes;
00103 
00104 };
00105 
00106 class SimEventLineMatchingOutput : public SimEvent
00107 {
00108 public:
00109   SimEventLineMatchingOutput(SimModule* src,
00110       std::vector<LineMatching::Shape2D>& shapes) :
00111     SimEvent(src), itsShapes(shapes)
00112   {}
00113 
00114   virtual ~SimEventLineMatchingOutput(){}
00115 
00116   std::vector<LineMatching::Shape2D> getShapes() { return itsShapes; }
00117 
00118 private:
00119   const std::vector<LineMatching::Shape2D>& itsShapes;
00120 };
00121 
00122 
00123 
00124 
00125 
00126 
00127 
00128 
00129 #endif //