VisTrackVisp.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
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 };// end namespace MipAlgorithms
00179 
00180 
00181 #endif /* __VISTRACKVISP_H */
00182 

Generated on Mon Feb 20 07:01:06 2017 for MIP by  doxygen 1.5.6