00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ARTOOKITPLUS_H
00021 #define ARTOOKITPLUS_H
00022
00023 #include <ardev/ardevconfig.h>
00024 #ifdef HAVE_ARTOOLKITPLUS
00025
00026 #include <ARToolKitPlus/ar.h>
00027 #include <ARToolKitPlus/Logger.h>
00028 #include <ardev/ardev.h>
00029
00030 #include <map>
00031
00032 namespace ARToolKitPlus
00033 {
00034 class Camera;
00035 class TrackerSingleMarker;
00036 }
00037
00038 struct intlt
00039 {
00040 public: bool operator () (const int & lhs, const int &rhs)
00041 {
00042 return lhs < rhs;
00043 };
00044 };
00045
00046 class MyLogger : public ARToolKitPlus::Logger
00047 {
00048 void artLog(const char* nStr)
00049 {
00050 printf(nStr);
00051 }
00052 };
00053
00054
00058 class ARToolKitPlusPreProcess : public FrameProcessObject
00059 {
00060 public:
00062 ARToolKitPlusPreProcess(CameraObject & Camera);
00063
00065 void ProcessFrame(const ARImage & frame);
00066
00069 int AddPattern(int id, double Height=0);
00071 void RemovePattern(int id);
00072
00074 bool GetMarkerPos(int id, ARPosition &result);
00075
00076 private:
00077 ARToolKitPlus::Camera * DummyCam;
00078 unsigned int lastFrameWidth;
00079 unsigned int lastFrameHeight;
00080 int minfocnt;
00081 ARToolKitPlus::ARMarkerInfo *tmp_markers;
00082 ARCamera camera;
00083
00084 bool useBCH;
00085 MyLogger logger;
00086 ARToolKitPlus::TrackerSingleMarker *tracker;
00087 ARImage GrayImage;
00088
00089 std::map<int,double,intlt> MarkerHeights;
00090
00091 };
00092
00095 class ARToolKitPlusPosition : public PositionObject
00096 {
00097 public:
00099 ARToolKitPlusPosition(ARToolKitPlusPreProcess & pre,int ID,double Height) : Pre(pre)
00100 {
00101 DroppedFrames = 0;
00102 MarkerID = Pre.AddPattern(ID, Height);
00103 };
00105 ~ARToolKitPlusPosition()
00106 {
00107 Pre.RemovePattern(MarkerID);
00108 };
00109
00111 virtual ARPosition GetPosition();
00112
00114 virtual bool Present();
00115
00116 protected:
00117 ARToolKitPlusPreProcess & Pre;
00118 unsigned int MarkerID;
00119 ARPosition lastGoodPosition;
00120 int DroppedFrames;
00121 };
00122
00123 #endif
00124 #endif