ViSP
2.7.0
|
#include <vpKltOpencv.h>
Public Member Functions | |
vpKltOpencv () | |
vpKltOpencv (const vpKltOpencv ©) | |
virtual | ~vpKltOpencv () |
void | initTracking (const IplImage *I, const IplImage *mask=NULL) |
void | track (const IplImage *I) |
void | display (const vpImage< unsigned char > &I, vpColor color=vpColor::red) |
void | setInitialGuess (CvPoint2D32f **guess_pts) |
void | setMaxFeatures (const int input) |
void | setWindowSize (const int input) |
void | setQuality (double input) |
void | setMinDistance (double input) |
void | setHarrisFreeParameter (double input) |
void | setBlockSize (const int input) |
void | setUseHarris (const int input) |
void | setPyramidLevels (const int input) |
void | setTrackerId (int tid) |
void | setOnInitialize (funcevent input) |
void | setOnFeatureLost (funcinfo input) |
void | setOnNewFeature (funcinfo input) |
void | setOnMeasureFeature (funcinfo input) |
void | setIsFeatureValid (funccheck input) |
int | getBlockSize () const |
CvPoint2D32f * | getFeatures () const |
long * | getFeaturesId () const |
double | getHarrisFreeParameter () const |
bool * | getListOfLostFeature () const |
int | getMaxFeatures () const |
double | getMinDistance () const |
int | getNbFeatures () const |
int | getNbPrevFeatures () const |
CvPoint2D32f * | getPrevFeatures () const |
long * | getPrevFeaturesId () const |
int | getPyramidLevels () const |
double | getQuality () const |
int | getWindowSize () const |
void | getFeature (int index, int &id, float &x, float &y) const |
void | getPrevFeature (int index, int &id, float &x, float &y) const |
void | addFeature (const int &id, const float &x, const float &y) |
void | suppressFeature (int index) |
Static Public Member Functions | |
static void | display (const vpImage< unsigned char > &I, const CvPoint2D32f *features_list, const int &nbFeatures, vpColor color=vpColor::green, unsigned int thickness=1) |
static void | display (const vpImage< vpRGBa > &I, const CvPoint2D32f *features_list, const int &nbFeatures, vpColor color=vpColor::green, unsigned int thickness=1) |
static void | display (const vpImage< unsigned char > &I, const CvPoint2D32f *features_list, const long *featuresid_list, const int &nbFeatures, vpColor color=vpColor::green, unsigned int thickness=1) |
static void | display (const vpImage< vpRGBa > &I, const CvPoint2D32f *features_list, const long *featuresid_list, const int &nbFeatures, vpColor color=vpColor::green, unsigned int thickness=1) |
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented with OpenCV.
The following example shows how to use the main functions of the class:
Definition at line 141 of file vpKltOpencv.h.
vpKltOpencv::vpKltOpencv | ( | ) |
Definition at line 102 of file vpKltOpencv.cpp.
vpKltOpencv::vpKltOpencv | ( | const vpKltOpencv & | copy | ) |
Definition at line 149 of file vpKltOpencv.cpp.
|
virtual |
Definition at line 260 of file vpKltOpencv.cpp.
void vpKltOpencv::addFeature | ( | const int & | id, |
const float & | x, | ||
const float & | y | ||
) |
Add at the end of the feauture list.
If there is no space left, the feature is not added (just return)
Definition at line 539 of file vpKltOpencv.cpp.
References vpERROR_TRACE.
void vpKltOpencv::display | ( | const vpImage< unsigned char > & | I, |
vpColor | color = vpColor::red |
||
) |
Definition at line 447 of file vpKltOpencv.cpp.
References vpImage< Type >::bitmap, vpException::memoryAllocationError, and vpERROR_TRACE.
|
static |
Display features list.
I | : The image used as background. |
features_list | : List of features |
nbFeatures | : Number of features |
color | : Color used to display the points. |
thickness | : Thickness of the points. |
Definition at line 586 of file vpKltOpencv.cpp.
References vpDisplay::displayCross(), vpMath::round(), vpImagePoint::set_u(), and vpImagePoint::set_v().
|
static |
Display features list.
I | : The image used as background. |
features_list | : List of features |
nbFeatures | : Number of features |
color | : Color used to display the points. |
thickness | : Thickness of the points. |
Definition at line 611 of file vpKltOpencv.cpp.
References vpDisplay::displayCross(), vpMath::round(), vpImagePoint::set_u(), and vpImagePoint::set_v().
|
static |
Display features list with ids.
I | : The image used as background. |
features_list | : List of features |
featuresid_list | : List of ids corresponding to the features list |
nbFeatures | : Number of features |
color | : Color used to display the points. |
thickness | : Thickness of the points |
Definition at line 639 of file vpKltOpencv.cpp.
References vpDisplay::displayCharString(), vpDisplay::displayCross(), vpMath::round(), vpImagePoint::set_u(), and vpImagePoint::set_v().
|
static |
Display features list with ids.
I | : The image used as background. |
features_list | : List of features |
featuresid_list | : List of ids corresponding to the features list |
nbFeatures | : Number of features |
color | : Color used to display the points. |
thickness | : Thickness of the points |
Definition at line 673 of file vpKltOpencv.cpp.
References vpDisplay::displayCharString(), vpDisplay::displayCross(), vpMath::round(), vpImagePoint::set_u(), and vpImagePoint::set_v().
|
inline |
Get the block size.
Definition at line 283 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::setKltOpencv().
void vpKltOpencv::getFeature | ( | int | index, |
int & | id, | ||
float & | x, | ||
float & | y | ||
) | const |
Get the 'index'th feature image coordinates. Beware that getFeature(i,...) may not represent the same feature before and after a tracking iteration (if a feature is lost, features are shifted in the array).
index | : index of feature |
id | : id of the feature |
x | : x coordinate |
y | : y coordinate |
Definition at line 472 of file vpKltOpencv.cpp.
References vpException::memoryAllocationError, and vpERROR_TRACE.
Referenced by vpMbtKltPolygon::computeNbDetectedCurrent(), vpMbKltTracker::getKltImagePoints(), vpMbKltTracker::getKltImagePointsWithId(), and vpMbtKltPolygon::init().
|
inline |
Get the list of features.
Definition at line 285 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::getKltPoints().
|
inline |
Get the list of features id.
Definition at line 287 of file vpKltOpencv.h.
|
inline |
Get Harris free parameter.
Definition at line 289 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::setKltOpencv().
|
inline |
Get the list of lost feature.
Definition at line 291 of file vpKltOpencv.h.
|
inline |
Get Max number of features.
Definition at line 293 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::setKltOpencv(), and vpMbKltTracker::setPose().
|
inline |
Get Min Distance.
Definition at line 295 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::setKltOpencv().
|
inline |
Get the current number of features.
Definition at line 297 of file vpKltOpencv.h.
Referenced by vpMbtKltPolygon::computeNbDetectedCurrent(), vpMbKltTracker::getKltImagePoints(), vpMbKltTracker::getKltImagePointsWithId(), vpMbKltTracker::getNbKltPoints(), and vpMbtKltPolygon::init().
|
inline |
Get the previous number of features.
Definition at line 299 of file vpKltOpencv.h.
void vpKltOpencv::getPrevFeature | ( | int | index, |
int & | id, | ||
float & | x, | ||
float & | y | ||
) | const |
Get the 'index'th previous feature image coordinates. Beware that getPrevFeature(i,...) may not represent the same feature before and after a tracking iteration (if a feature is lost, features are shifted in the array).
Definition at line 520 of file vpKltOpencv.cpp.
References vpException::memoryAllocationError, and vpERROR_TRACE.
|
inline |
Get the list of features.
Definition at line 301 of file vpKltOpencv.h.
|
inline |
Get the list of features id.
Definition at line 303 of file vpKltOpencv.h.
|
inline |
Get the number of pyramid levels.
Definition at line 305 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::setKltOpencv().
|
inline |
Get the quality of the tracker.
Definition at line 307 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::setKltOpencv().
|
inline |
Get Max number of features.
Definition at line 309 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::setKltOpencv().
void vpKltOpencv::initTracking | ( | const IplImage * | I, |
const IplImage * | mask = NULL |
||
) |
Definition at line 291 of file vpKltOpencv.cpp.
References vpTrackingException::initializationError.
Referenced by vpMbKltTracker::reinit().
|
inline |
Set the size of the averaging block used to track the features.
input | : The new size of the block. |
Definition at line 255 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::loadConfigFile(), vpMbKltTracker::resetTracker(), vpMbKltTracker::setKltOpencv(), and vpMbKltTracker::vpMbKltTracker().
|
inline |
Set the Harris parameter (The k value).
input | : The new Harris parameter. |
Definition at line 245 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::loadConfigFile(), vpMbKltTracker::resetTracker(), vpMbKltTracker::setKltOpencv(), and vpMbKltTracker::vpMbKltTracker().
void vpKltOpencv::setInitialGuess | ( | CvPoint2D32f ** | guess_pts | ) |
Set the points that will be used as initial guess during the next call to track().
guess_pts | : Reference on an array of CvPoint2D32f allocated with cvAlloc(). |
Definition at line 494 of file vpKltOpencv.cpp.
Referenced by vpMbKltTracker::setPose().
|
inline |
Definition at line 280 of file vpKltOpencv.h.
void vpKltOpencv::setMaxFeatures | ( | const int | input | ) |
Set the maximum number of features to track in the image.
input | : The new number of maximum features. |
Definition at line 272 of file vpKltOpencv.cpp.
Referenced by vpMbKltTracker::loadConfigFile(), vpMbKltTracker::resetTracker(), vpMbKltTracker::setKltOpencv(), and vpMbKltTracker::vpMbKltTracker().
|
inline |
Set the minimal distance between two points during the initialisation.
input | : The new minimal distance between two points. |
Definition at line 236 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::loadConfigFile(), vpMbKltTracker::resetTracker(), vpMbKltTracker::setKltOpencv(), and vpMbKltTracker::vpMbKltTracker().
|
inline |
Definition at line 274 of file vpKltOpencv.h.
|
inline |
Definition at line 272 of file vpKltOpencv.h.
|
inline |
Definition at line 278 of file vpKltOpencv.h.
|
inline |
Definition at line 276 of file vpKltOpencv.h.
|
inline |
Set the maximal pyramid level. If the level is zero, then no pyramid is computed for the optical flow.
input | : The new maximal pyramid level. |
Definition at line 266 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::loadConfigFile(), vpMbKltTracker::resetTracker(), vpMbKltTracker::setKltOpencv(), and vpMbKltTracker::vpMbKltTracker().
|
inline |
Definition at line 227 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::loadConfigFile(), vpMbKltTracker::resetTracker(), vpMbKltTracker::setKltOpencv(), and vpMbKltTracker::vpMbKltTracker().
|
inline |
Definition at line 267 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::resetTracker(), and vpMbKltTracker::vpMbKltTracker().
|
inline |
Definition at line 256 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::resetTracker(), and vpMbKltTracker::vpMbKltTracker().
|
inline |
Set the window size for the sub-pixel computation.
input | : The new number of maximum features. |
Definition at line 226 of file vpKltOpencv.h.
Referenced by vpMbKltTracker::loadConfigFile(), vpMbKltTracker::resetTracker(), vpMbKltTracker::setKltOpencv(), and vpMbKltTracker::vpMbKltTracker().
void vpKltOpencv::suppressFeature | ( | int | index | ) |
Definition at line 556 of file vpKltOpencv.cpp.
References vpException::memoryAllocationError, and vpERROR_TRACE.
void vpKltOpencv::track | ( | const IplImage * | I | ) |
Definition at line 366 of file vpKltOpencv.cpp.
References vpTrackingException::initializationError, and vpERROR_TRACE.
Referenced by vpMbKltTracker::preTracking().