54 #include <visp/vpConfig.h>
56 #ifdef VISP_HAVE_OPENCV
59 #pragma package <opencv>
62 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1
63 # include <opencv2/imgproc/imgproc.hpp>
64 # include <opencv2/video/tracking.hpp>
65 # include <opencv2/legacy/legacy.hpp>
66 # include <opencv2/highgui/highgui.hpp>
76 #include <visp/vpConfig.h>
77 #include <visp/vpImage.h>
78 #include <visp/vpImageIo.h>
79 #include <visp/vpDisplay.h>
80 #include <visp/vpDebug.h>
81 #include <visp/vpException.h>
82 #include <visp/vpTrackingException.h>
84 typedef int (*funccheck)(int,double,double);
85 typedef void (*funcinfo)(int,int,int,double,double);
86 typedef void (*funcevent)(int);
109 int globalcountFeatures;
116 double harris_free_parameter;
123 IplImage *prev_image;
125 IplImage *prev_pyramid;
129 int countPrevFeatures;
131 CvPoint2D32f *features;
132 CvPoint2D32f *prev_features;
135 long *prev_featuresid;
141 bool *lostDuringTrack;
147 funcevent OnInitialize;
148 funcinfo OnFeatureLost;
149 funcinfo OnNewFeature;
150 funcinfo OnMeasureFeature;
151 funccheck IsFeatureValid;
165 void addFeature(
const int &
id,
const float &x,
const float &y);
173 void getFeature(
int index,
int &
id,
float &x,
float &y)
const;
190 void getPrevFeature(
int index,
int &
id,
float &x,
float &y)
const;
203 void initTracking(
const IplImage *I,
const IplImage *mask = NULL);
207 void track(
const IplImage *I);
219 void setBlockSize(
const int input) {initialized = 0; block_size=input;}
228 void setInitialGuess(CvPoint2D32f **guess_pts);
235 void setMaxFeatures(
const int input);
264 void setQuality(
double input) {initialized = 0; quality=input;}
273 void setUseHarris(
const int input) {initialized = 0; use_harris=input;}
276 void suppressFeature(
int index);
282 unsigned int thickness=1);
283 static void display(
const vpImage<vpRGBa>& I,
const CvPoint2D32f* features_list,
285 unsigned int thickness=1);
288 const long *featuresid_list,
const int &nbFeatures,
290 static void display(
const vpImage<vpRGBa>& I,
const CvPoint2D32f* features_list,
291 const long *featuresid_list,
const int &nbFeatures,
void setOnInitialize(funcevent input)
int getPyramidLevels() const
Get the number of pyramid levels.
void setQuality(double input)
void setOnFeatureLost(funcinfo input)
int getMaxFeatures() const
Get Max number of features.
CvPoint2D32f * getFeatures() const
Get the list of features.
void setOnNewFeature(funcinfo input)
double getHarrisFreeParameter() const
Get Harris free parameter.
Class to define colors available for display functionnalities.
void setUseHarris(const int input)
void setOnMeasureFeature(funcinfo input)
void setPyramidLevels(const int input)
void setBlockSize(const int input)
CvPoint2D32f * getPrevFeatures() const
Get the list of features.
static const vpColor green
long * getFeaturesId() const
Get the list of features id.
void setWindowSize(const int input)
double getQuality() const
Get the quality of the tracker.
void setTrackerId(int tid)
int getBlockSize() const
Get the block size.
void setIsFeatureValid(funccheck input)
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV.
int getNbFeatures() const
Get the current number of features.
long * getPrevFeaturesId() const
Get the list of features id.
double getMinDistance() const
Get Min Distance.
int getNbPrevFeatures() const
Get the previous number of features.
void setMinDistance(double input)
bool * getListOfLostFeature() const
Get the list of lost feature.
int getWindowSize() const
Get Max number of features.
void setHarrisFreeParameter(double input)