MarkerData.h
Go to the documentation of this file.00001
00002 #ifndef _MARKERDATA_H_
00003 #define _MARKERDATA_H_
00004
00005 #include <vector>
00006 #include <set>
00007 #include <map>
00008 #include <iostream>
00009 #include <string>
00010
00011 #include "Shared/fmatSpatial.h"
00012
00013 #include "BaseData.h"
00014 #include "Point.h"
00015 #include "SketchTypes.h"
00016
00017 namespace DualCoding {
00018
00019 class ShapeRoot;
00020 template<typename T> class Sketch;
00021
00022 class MarkerData;
00023 class MapBuilderRequest;
00024
00025 typedef std::string MarkerType_t;
00026 typedef std::vector<Shape<MarkerData> > (*MarkerExtractFn_t)(const Sketch<uchar>&, const MapBuilderRequest&);
00027
00028
00029 class MarkerData : public BaseData {
00030 public:
00031
00032 Point center;
00033
00034 MarkerType_t typeOfMarker;
00035
00036 static const MarkerType_t unknownMarkerType;
00037
00038 public:
00039
00040 MarkerData(ShapeSpace& _space, const Point& center, const rgb rgbvalue=rgb());
00041
00042 static ShapeType_t getStaticType() { return markerDataType; }
00043
00044 MarkerType_t getMarkerType() const { return typeOfMarker; }
00045
00046 DATASTUFF_H(MarkerData);
00047
00048 friend class Shape<MarkerData>;
00049
00050
00051 virtual Point getCentroid() const;
00052
00053
00054 virtual void printParams() const;
00055
00056
00057 virtual void applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref=unspecified);
00058
00059
00060 virtual void projectToGround(const fmat::Transform& camToBase,
00061 const PlaneEquation& groundplane);
00062
00063
00064 virtual void update_derived_properties();
00065
00066
00067 virtual bool isMatchFor(const ShapeRoot& other) const;
00068
00069
00070 virtual bool updateParams(const ShapeRoot& other, bool forceUpdate=false);
00071
00072
00073
00074
00075
00076 virtual bool isMatchingMarker(const Shape<MarkerData>& other) const;
00077
00078 virtual bool localizeByCamera() const {return true;}
00079
00080 virtual unsigned short getDimension() const { return 3; }
00081
00082
00083 virtual std::string getMarkerDescription() const;
00084
00085
00086 static std::string getMarkerTypeName(MarkerType_t type);
00087
00088
00089 static MarkerType_t registerMarkerType(std::string markerTypeName, MarkerExtractFn_t extractor);
00090
00091
00092 static std::vector<Shape<MarkerData> > extractMarkers(const Sketch<uchar> &sketch, MarkerType_t type, const MapBuilderRequest &req);
00093
00094
00095 static std::vector<Shape<MarkerData> > extractMarkers(const Sketch<uchar> &sketch, const MapBuilderRequest &req);
00096
00097
00098 static void calculateCameraDistance(Point &p, const float height);
00099
00100
00101 static const std::set<MarkerType_t> allMarkerTypes();
00102
00103 private:
00104
00105 static std::map<MarkerType_t, MarkerExtractFn_t>& getExtractorMap();
00106
00107
00108 virtual Sketch<bool>* render() const;
00109
00110 MarkerData& operator=(const MarkerData&);
00111 };
00112
00113 }
00114
00115 #endif // MARKERDATA_H_