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 #ifndef TRACKERORIENTATION_H
00025 #define TRACKERORIENTATION_H
00026
00027 #include "Tracker.h"
00028 #include "TrackerFeatures.h"
00029 #include "Pose.h"
00030 #include "Camera.h"
00031
00038 namespace alvar {
00039
00043 class ALVAR_EXPORT TrackerOrientation : public Tracker {
00044
00045 public:
00046 TrackerOrientation(int width, int height, int image_scale=1, int outlier_limit=20)
00047 : _image_scale(image_scale)
00048 , _outlier_limit(outlier_limit)
00049 , _xres(width)
00050 , _yres(height)
00051 {
00052 _camera = 0;
00053 _grsc = 0;
00054 _object_model = 0;
00055 }
00056
00057 private:
00058
00059 struct Feature
00060 {
00061 enum {NOT_TRACKED=0, IS_TRACKED} status2D;
00062 enum {NONE=0, USE_FOR_POSE, IS_OUTLIER, IS_INITIAL} status3D;
00063
00064 Feature()
00065 {
00066 status3D = NONE;
00067 status2D = NOT_TRACKED;
00068 }
00069
00070 Feature(double vx, double vy)
00071 {
00072 point.x = float(vx);
00073 point.y = float(vy);
00074 status3D = NONE;
00075 status2D = NOT_TRACKED;
00076 }
00077
00078 ~Feature() {}
00079
00080 CvPoint2D32f point;
00081 CvPoint3D64f point3d;
00082 };
00083
00084 TrackerFeatures _ft;
00085 std::map<int,Feature> _F_v;
00086
00087 int _xres;
00088 int _yres;
00089 int _image_scale;
00090 int _outlier_limit;
00091
00092 Pose _pose;
00093 IplImage *_grsc;
00094 Camera *_camera;
00095 CvMat *_object_model;
00096
00097 public:
00098 void SetCamera(Camera *camera) {
00099 _camera = camera;
00100 }
00101 void GetPose(Pose &pose);
00102 void GetPose(double gl_mat[16]) {
00103 _pose.GetMatrixGL(gl_mat);
00104 }
00105 void Reset();
00106 double Track(IplImage *image);
00107
00108 private:
00109 static void Project(CvMat* state, CvMat* projection, void *param);
00110 bool UpdatePose(IplImage* image=0);
00111 bool UpdateRotationOnly(IplImage *gray, IplImage *image=0);
00112
00113 };
00114
00115 }
00116
00117 #endif
00118
00119