42 #ifndef _vpKltOpencv_h_
43 #define _vpKltOpencv_h_
45 #include <visp3/core/vpColor.h>
46 #include <visp3/core/vpConfig.h>
47 #include <visp3/core/vpImage.h>
49 #if defined(VISP_HAVE_OPENCV) && defined(HAVE_OPENCV_HIGHGUI) && defined(HAVE_OPENCV_IMGPROC) && defined(HAVE_OPENCV_VIDEO)
51 #include <opencv2/highgui/highgui.hpp>
52 #include <opencv2/imgproc/imgproc.hpp>
53 #include <opencv2/video/tracking.hpp>
94 void addFeature(
const float &x,
const float &y);
106 void addFeature(
const long &
id,
const float &x,
const float &y);
113 void addFeature(
const cv::Point2f &f);
141 static void display(
const vpImage<vpRGBa> &I,
const std::vector<cv::Point2f> &features,
154 unsigned int thickness = 1);
164 static void display(
const vpImage<vpRGBa> &I,
const std::vector<cv::Point2f> &features,
166 unsigned int thickness = 1);
181 void getFeature(
const int &index,
long &
id,
float &x,
float &y)
const;
183 std::vector<cv::Point2f>
getFeatures()
const {
return m_points[1]; }
225 void initTracking(
const cv::Mat &I,
const cv::Mat &mask = cv::Mat());
234 void initTracking(
const cv::Mat &I,
const std::vector<cv::Point2f> &pts);
244 void initTracking(
const cv::Mat &I,
const std::vector<cv::Point2f> &pts,
const std::vector<long> &ids);
256 void track(
const cv::Mat &I);
289 void setInitialGuess(
const std::vector<cv::Point2f> &guess_pts);
307 void setInitialGuess(
const std::vector<cv::Point2f> &init_pts,
const std::vector<cv::Point2f> &guess_pts,
308 const std::vector<long> &fid);
356 void setQuality(
double qualityLevel) { m_qualityLevel = qualityLevel; }
368 void setUseHarris(
int useHarrisDetector) { m_useHarrisDetector = useHarrisDetector; }
384 void suppressFeature(
const int &index);
389 std::vector<cv::Point2f> m_points[2];
Class to define RGB colors available for display functionalities.
static const vpColor green
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
std::vector< long > m_points_id
Keypoint id.
std::vector< cv::Point2f > getPrevFeatures() const
Get the list of previous features.
int m_useHarrisDetector
true to use Harris detector
int m_maxCount
Max number of keypoints.
double getQuality() const
int getMaxFeatures() const
Get the list of lost feature.
void setBlockSize(int blockSize)
int m_blockSize
Block size.
void setQuality(double qualityLevel)
int getNbPrevFeatures() const
Get the number of previous features.
void setTrackerId(int tid)
int getWindowSize() const
Get the window size used to refine the corner locations.
double m_minDistance
Mins distance between keypoints.
int getNbFeatures() const
Get the number of current features.
cv::TermCriteria m_termcrit
Term criteria.
std::vector< cv::Point2f > getFeatures() const
Get the list of current features.
double m_minEigThreshold
Min eigen threshold.
void setHarrisFreeParameter(double harris_k)
int m_pyrMaxLevel
Pyramid max level.
double getHarrisFreeParameter() const
Get the free parameter of the Harris detector.
double m_qualityLevel
Quality level.
bool m_initial_guess
true when initial guess is provided
cv::Mat m_gray
Gray image.
void setMaxFeatures(int maxCount)
void setMinEigThreshold(double minEigThreshold)
std::vector< long > getFeaturesId() const
Get the unique id of each feature.
double m_harris_k
Harris parameter.
double getMinDistance() const
int m_winSize
Window criteria.
long m_next_points_id
Id for the newt keypoint.
cv::Mat m_prevGray
Previous gray image.
void setMinDistance(double minDistance)
int getBlockSize() const
Get the size of the averaging block used to track the features.
int getPyramidLevels() const
Get the list of features id.
void setUseHarris(int useHarrisDetector)
void setWindowSize(int winSize)
void setPyramidLevels(int pyrMaxLevel)