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>
233 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
275 const bool displayFullModel =
false);
277 const vpColor& col,
const unsigned int thickness=1,
const bool displayFullModel =
false);
291 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
347 const bool verbose=
false);
349 const bool verbose=
false);
391 #ifdef VISP_HAVE_OGRE
404 for(std::list<vpMbtDistanceKltPoints*>::const_iterator it=
kltPolygons.begin(); it!=
kltPolygons.end(); ++it)
405 (*it)->useScanLine = v;
417 vpCTRACE <<
"This option is not yet implemented in vpMbKltTracker, projection error computation set to false." << std::endl ; }
437 double &mu,
bool &reStartFromLastIncrement);
441 std::list<vpMbtDistanceKltPoints*> &kltPolygons_, std::list<vpMbtDistanceKltCylinder*> &kltCylinders_,
454 const std::string &name=
"");
456 const std::string &name=
"");
465 #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.
virtual std::list< vpMbtDistanceCircle * > & getFeaturesCircle()
void setWindowName(const Ogre::String &n)
std::list< vpMbtDistanceKltPoints * > kltPolygons
void setThresholdAcceptation(const double th)
Implementation of a matrix and operations on matrices.
virtual ~vpMbKltTracker()
double lambda
The gain of the virtual visual servoing stage.
virtual void setScanLineVisibilityTest(const bool &v)
virtual void track(const vpImage< unsigned char > &I)=0
void computeVVSPoseEstimation(const unsigned int iter, vpMatrix &L, const vpColVector &w, vpMatrix &L_true, vpMatrix &LVJ_true, double &normRes, double &normRes_1, vpColVector &w_true, vpColVector &R, vpMatrix <L, vpColVector <R, vpColVector &error_prev, vpColVector &v, double &mu, vpHomogeneousMatrix &cMoPrev, vpHomogeneousMatrix &ctTc0_Prev)
virtual void addCircle(const vpPoint &P1, const vpPoint &P2, const vpPoint &P3, const double r, const std::string &name="")
virtual void setUseKltTracking(const std::string &name, const bool &useKltTracking)
virtual void computeVVS(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, std::map< std::string, unsigned int > &mapOfNumberOfRows, std::map< std::string, unsigned int > &mapOfNbInfos, vpColVector &w_mbt, vpColVector &w_klt, const unsigned int lvl=0)
vpMbHiddenFaces< vpMbtPolygon > faces
Set of faces describing the object.
virtual void setLambda(const double gain)
unsigned int maxIter
The maximum iteration of the virtual visual servoing stage.
virtual void computeVVSWeights(const unsigned int iter, const unsigned int nbInfos, std::map< std::string, unsigned int > &mapOfNbInfos, vpColVector &R, vpColVector &w_true, vpColVector &w, std::map< std::string, vpRobust > &mapOfRobusts, double threshold)
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)
virtual void preTracking(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, std::map< std::string, unsigned int > &mapOfNbInfos, std::map< std::string, unsigned int > &mapOfNbFaceUsed)
Class to define colors available for display functionnalities.
double percentGood
Percentage of good points, according to the initial number, that must have the tracker.
vpHomogeneousMatrix cMo
The current pose.
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
vpMbScanLine & getMbScanLineRenderer()
Hybrid stereo (or more) tracker based on moving-edges and keypoints tracked using KLT tracker...
void computeVVSCheckLevenbergMarquardtKlt(const unsigned int iter, const unsigned int nbInfos, const vpHomogeneousMatrix &cMoPrev, const vpColVector &error_prev, const vpHomogeneousMatrix &ctTc0_Prev, double &mu, bool &reStartFromLastIncrement)
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
Class that defines what is a point.
vpCameraParameters cam
The camera parameters.
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
std::vector< cv::Point2f > getKltPoints() const
virtual std::map< std::string, std::vector< vpImagePoint > > getKltImagePoints() const
Implementation of an homography and operations on homographies.
vpAROgre * getOgreContext()
void computeVVSInteractionMatrixAndResidu(unsigned int shift, vpColVector &R, vpMatrix &L, vpHomography &H, std::list< vpMbtDistanceKltPoints * > &kltPolygons_, std::list< vpMbtDistanceKltCylinder * > &kltCylinders_, const vpHomogeneousMatrix &ctTc0_)
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)
virtual std::map< std::string, std::vector< cv::Point2f > > getKltPoints() const
virtual void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo_, const bool verbose=false)
unsigned int maskBorder
Erosion of the mask.
virtual void initFaceFromCorners(vpMbtPolygon &polygon)=0
Generic class defining intrinsic camera parameters.
Main methods for a model-based tracker.
virtual std::list< vpMbtDistanceKltPoints * > & getFeaturesKlt()
Model based tracker using only KLT.
virtual void loadConfigFile(const std::string &configFile)=0
vpKltOpencv tracker
Points tracker.
std::list< vpMbtDistanceKltCylinder * > kltCylinders
virtual std::list< vpMbtDistanceKltCylinder * > & getFeaturesKltCylinder()
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)
virtual void setKltOpencv(const vpKltOpencv &t)
virtual std::map< std::string, std::map< int, vpImagePoint > > getKltImagePointsWithId() const
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. Thus to enable this ...
int getNbFeatures() const
Get the number of current features.
Contains an M-Estimator and various influence function.
double getThresholdAcceptation() const
virtual void postTracking(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, vpColVector &w_mbt, vpColVector &w_klt, std::map< std::string, unsigned int > &mapOfNumberOfRows, std::map< std::string, unsigned int > &mapOfNbInfos, const unsigned int lvl)
unsigned int maxIter
The maximum iteration of the virtual visual servoing stage.
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
virtual void setScanLineVisibilityTest(const bool &v)
void computeVVSCovariance(const vpColVector &w_true, const vpHomogeneousMatrix &cMoPrev, const vpMatrix &L_true, const vpMatrix &LVJ_true)
virtual unsigned int getMaxIter() const
Model based stereo (or more) tracker using only KLT.
vpHomogeneousMatrix c0Mo
Initial pose.
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace=0, const std::string &name="")=0