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);
147 int globalcountFeatures;
154 double harris_free_parameter;
161 IplImage *prev_image;
163 IplImage *prev_pyramid;
167 int countPrevFeatures;
169 CvPoint2D32f *features;
170 CvPoint2D32f *prev_features;
173 long *prev_featuresid;
179 bool *lostDuringTrack;
185 funcevent OnInitialize;
186 funcinfo OnFeatureLost;
187 funcinfo OnNewFeature;
188 funcinfo OnMeasureFeature;
189 funccheck IsFeatureValid;
204 void initTracking(
const IplImage *I,
const IplImage *mask = NULL);
207 void track(
const IplImage *I);
214 void setInitialGuess(CvPoint2D32f **guess_pts);
217 void setMaxFeatures(
const int input);
227 void setQuality(
double input) {initialized = 0; quality=input;}
255 void setBlockSize(
const int input) {initialized = 0; block_size=input;}
256 void setUseHarris(
const int input) {initialized = 0; use_harris=input;}
311 void getFeature(
int index,
int &
id,
float &x,
float &y)
const;
312 void getPrevFeature(
int index,
int &
id,
float &x,
float &y)
const;
313 void addFeature(
const int &
id,
const float &x,
const float &y);
314 void suppressFeature(
int index);
320 unsigned int thickness=1);
321 static void display(
const vpImage<vpRGBa>& I,
const CvPoint2D32f* features_list,
323 unsigned int thickness=1);
326 const long *featuresid_list,
const int &nbFeatures,
328 static void display(
const vpImage<vpRGBa>& I,
const CvPoint2D32f* features_list,
329 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 with 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)