43 #ifndef vpMbKltTracker_h
44 #define vpMbKltTracker_h
46 #include <visp3/core/vpConfig.h>
48 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
50 #include <visp3/mbt/vpMbTracker.h>
51 #include <visp3/klt/vpKltOpencv.h>
52 #include <visp3/core/vpMeterPixelConversion.h>
53 #include <visp3/core/vpPixelMeterConversion.h>
54 #include <visp3/mbt/vpMbtKltXmlParser.h>
55 #include <visp3/vision/vpHomography.h>
56 #include <visp3/core/vpRobust.h>
57 #include <visp3/core/vpSubColVector.h>
58 #include <visp3/core/vpSubMatrix.h>
59 #include <visp3/core/vpExponentialMap.h>
60 #include <visp3/mbt/vpMbtDistanceKltPoints.h>
61 #include <visp3/mbt/vpMbtDistanceCircle.h>
62 #include <visp3/mbt/vpMbtDistanceKltCylinder.h>
228 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
264 void addCircle(
const vpPoint &P1,
const vpPoint &P2,
const vpPoint &P3,
const double r,
const std::string &name=
"");
267 const bool displayFullModel =
false);
269 const vpColor& col,
const unsigned int thickness=1,
const bool displayFullModel =
false);
290 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
293 inline CvPoint2D32f* getKltPoints() {
return tracker.
getFeatures();}
296 std::vector<vpImagePoint> getKltImagePoints()
const;
298 std::map<int, vpImagePoint> getKltImagePointsWithId()
const;
312 virtual inline double getLambda()
const {
return lambda;}
326 virtual inline unsigned int getMaxIter()
const {
return maxIter;}
343 const bool verbose=
false);
345 const bool verbose=
false);
357 virtual inline void setLambda(
const double gain) {this->lambda = gain;}
368 faces.getMbScanLineRenderer().setMaskBorder(maskBorder);
376 virtual inline void setMaxIter(
const unsigned int max) {maxIter = max;}
387 #ifdef VISP_HAVE_OGRE
388 faces.getOgreContext()->setWindowName(
"MBT Klt");
400 for(std::list<vpMbtDistanceKltPoints*>::const_iterator it=kltPolygons.begin(); it!=kltPolygons.end(); ++it)
401 (*it)->useScanLine = v;
413 vpCTRACE <<
"This option is not yet implemented in vpMbKltTracker, projection error computation set to false." << std::endl ; }
422 void setUseKltTracking(
const std::string &name,
const bool &useKltTracking);
428 void computeVVS(
const unsigned int &nbInfos,
vpColVector &w);
433 const std::string &name=
"");
435 const std::string &name=
"");
442 #endif // VISP_HAVE_OPENCV
bool compute_interaction
If true, compute the interaction matrix at each iteration of the minimization. Otherwise, compute it only on the first iteration.
std::list< vpMbtDistanceKltPoints * > kltPolygons
void setThresholdAcceptation(const double th)
virtual void setScanLineVisibilityTest(const bool &v)
virtual void track(const vpImage< unsigned char > &I)=0
virtual void setLambda(const double gain)
unsigned int maxIter
The maximum iteration of the virtual visual servoing stage.
std::vector< cv::Point2f > getFeatures() const
Get the list of current features.
Implementation of an homogeneous matrix and operations on such kind of matrices.
virtual void setProjectionErrorComputation(const bool &flag)
Class to define colors available for display functionnalities.
double percentGood
Percentage of good points, according to the initial number, that must have the tracker.
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius, const int idFace=0, const std::string &name="")=0
virtual double getLambda() const
std::list< vpMbtDistanceCircle * > & getFeaturesCircle()
bool firstInitialisation
Flag to specify whether the init method is called the first or not (specific calls to realize in this...
virtual void resetTracker()=0
std::list< vpMbtDistanceKltCylinder * > & getFeaturesKltCylinder()
Class that defines what is a point.
std::vector< cv::Point2f > getKltPoints()
vpHomogeneousMatrix ctTc0
The estimated displacement of the pose between the current instant and the initial position...
virtual void init(const vpImage< unsigned char > &I)=0
unsigned int getMaskBorder() const
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)=0
Implementation of a polygon of the model used by the model-based tracker.
virtual void setCameraParameters(const vpCameraParameters &camera)
unsigned int maskBorder
Erosion of the mask.
virtual void initFaceFromCorners(vpMbtPolygon &polygon)=0
Generic class defining intrinsic camera parameters.
std::list< vpMbtDistanceKltPoints * > & getFeaturesKlt()
Main methods for a model-based tracker.
Model based tracker using only KLT.
virtual void loadConfigFile(const std::string &configFile)=0
vpKltOpencv tracker
Points tracker.
std::list< vpMbtDistanceKltCylinder * > kltCylinders
double threshold_outlier
Threshold below which the weight associated to a point to consider this one as an outlier...
virtual void setMaxIter(const unsigned int max)
cv::Mat cur
Temporary OpenCV image for fast conversion.
double lambda
The gain of the virtual visual servoing stage.
int getNbKltPoints() const
vpKltOpencv getKltOpencv() const
std::list< vpMbtDistanceCircle * > circles_disp
Vector of the circles used here only to display the full model.
virtual void setOgreVisibilityTest(const bool &v)
void setMaskBorder(const unsigned int &e)
Implementation of column vector and the associated operations.
virtual void initFaceFromLines(vpMbtPolygon &polygon)=0
virtual void setOgreVisibilityTest(const bool &v)
virtual void testTracking()=0
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV.
int getNbFeatures() const
Get the number of current features.
double getThresholdAcceptation() const
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
virtual void setScanLineVisibilityTest(const bool &v)
virtual unsigned int getMaxIter() const
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace=0, const std::string &name="")=0