VisTrackVisp.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 #ifndef __VISTRACKVISP_H
00027 #define __VISTRACKVISP_H
00028
00029 #include <visp/vpImage.h>
00030
00031 #include <visp/vpImageIo.h>
00032
00033 #include <visp/vpDot2.h>
00034 #include <visp/vpIoTools.h>
00035
00036 #include <VisualTracking.h>
00037
00038 namespace MipAlgorithms{
00042
00046
00048
00049
00050 class VisualTrackVispVar : public VisualTrackVar{
00051 private:
00052 int displayRes;
00053 int videoSaving;
00054 int init;
00055 pthread_mutex_t _initMutex;
00056 public:
00057 vpDot2 _d2;
00058 vpImagePoint _cog;
00059 vpImagePoint initPoint;
00060 IplImage *image;
00061 int track;
00062 int grayLevel;
00063
00064 CvVideoWriter *videoWriter;
00065
00066 CvSize refScaleFact;
00067 CvPoint imageCentre;
00068
00069 vpImage<unsigned char> _frameVP;
00070
00072 VisualTrackVispVar(bool green, bool moments, Decimal grayLevel);
00073
00075 ~VisualTrackVispVar();
00076
00080 void setDisplay(int level);
00081
00084 int getDisplay() { return displayRes; }
00085
00087 void closeDisplay();
00088
00090 void setInit(int newVal) {
00091 pthread_mutex_lock(&_initMutex);
00092 init = newVal;
00093 pthread_mutex_unlock(&_initMutex);
00094 }
00095
00097 int getInit() {
00098 pthread_mutex_lock(&_initMutex);
00099 int ret = init;
00100 pthread_mutex_unlock(&_initMutex);
00101 return ret;
00102 }
00103
00106 void setVideoSaving(int videoFlag);
00107
00110 int getVideoSaving() { return videoSaving; }
00111
00112 };
00113
00117 class VisTrackVisp : public VisualTracking {
00118 private:
00119 VisualTrackVispVar* _wv;
00120 ImageFeature* _vf;
00121
00122 pthread_mutex_t _imgFeatMutex;
00123
00124 void init();
00125 public:
00127 VisTrackVisp(IplImage* img, bool green, bool moments, Decimal grayLevel, int vSav);
00128
00130 ~VisTrackVisp();
00131
00133 static void VtcMouseCallback(int event, int x, int y, int flags, void*param);
00134
00137 void getEstPose(Pose3D *pose);
00138
00141 void setEstPose(Pose3D *pose);
00142
00145 void getLastFeatureErr(ImageFeature& f);
00146
00149 void setFeatureErr(ImageFeature& f);
00150
00155 bool getFeatureErr(IplImage* frame, MipBaselib::Time& newTime, ImageFeature& f);
00156
00161 bool trackReference(IplImage* frame, MipBaselib::Time& newTime);
00162
00166 void setDisplay(int level) {
00167 _wv->setDisplay(level);
00168 }
00169
00172 bool displayTrack(int addInfo = 1);
00173
00174 VisualTrackVispVar* getVar() { return _wv; }
00175 };
00176
00177
00178 };
00179
00180
00181 #endif
00182