00001
00002
00003 #ifndef JAFAR_IMAGE_LK_TRACKER_HPP
00004 #define JAFAR_IMAGE_LK_TRACKER_HPP
00005
00006 #include "image/Image.hpp"
00007 #if CV_MAJOR_VERSION == 2 && CV_MINOR_VERSION > 1
00008 #include "opencv2/video/tracking.hpp"
00009 #endif
00010
00011 namespace jafar {
00012 namespace image {
00013
00018 class LKTracker {
00019
00020 private:
00021
00022 double qualityLevel;
00023 double minDistance;
00024 double harrisFreeParam;
00025 int halfWinSize;
00026 int maxPyramidLevel;
00027
00028 int m_nbPoints, m_maxNbPoints;
00029 int m_pyramidFlags;
00030 Image *m_imagePrev;
00031 std::vector<cv::Point2f> m_pointsPrev, m_pointsCur;
00032 std::vector<unsigned char> m_status;
00033 std::vector<float> m_errors;
00034
00035 public:
00036
00037 LKTracker();
00038 ~LKTracker();
00039
00040 int nbPoints() const {return m_nbPoints;}
00041 const std::vector<cv::Point2f> pointsCur() const {return m_pointsCur;}
00042
00043 void init(Image const& image);
00044 void track(Image const& image);
00045
00046 };
00047
00048 }
00049 }
00050
00051 #endif // JAFAR_IMAGE_LK_TRACKER_HPP