39 #ifndef _vpMbKltTracker_h_
40 #define _vpMbKltTracker_h_
42 #include <visp3/core/vpConfig.h>
44 #if defined(VISP_HAVE_MODULE_KLT) && defined(VISP_HAVE_OPENCV) && defined(HAVE_OPENCV_IMGPROC) && defined(HAVE_OPENCV_VIDEO)
46 #include <visp3/core/vpExponentialMap.h>
47 #include <visp3/core/vpMeterPixelConversion.h>
48 #include <visp3/core/vpPixelMeterConversion.h>
49 #include <visp3/core/vpSubColVector.h>
50 #include <visp3/core/vpSubMatrix.h>
51 #include <visp3/klt/vpKltOpencv.h>
52 #include <visp3/mbt/vpMbTracker.h>
53 #include <visp3/mbt/vpMbtDistanceCircle.h>
54 #include <visp3/mbt/vpMbtDistanceKltCylinder.h>
55 #include <visp3/mbt/vpMbtDistanceKltPoints.h>
56 #include <visp3/vision/vpHomography.h>
258 void addCircle(
const vpPoint &P1,
const vpPoint &P2,
const vpPoint &P3,
double r,
const std::string &name =
"");
260 const vpColor &col,
unsigned int thickness = 1,
bool displayFullModel =
false)
override;
262 const vpColor &col,
unsigned int thickness = 1,
bool displayFullModel =
false)
override;
269 virtual std::list<vpMbtDistanceKltPoints *> &
getFeaturesKlt() {
return kltPolygons; }
278 std::vector<vpImagePoint> getKltImagePoints()
const;
280 std::map<int, vpImagePoint> getKltImagePointsWithId()
const;
315 virtual std::vector<std::vector<double> >
getModelForDisplay(
unsigned int width,
unsigned int height,
318 bool displayFullModel =
false)
override;
320 virtual void loadConfigFile(
const std::string &configFile,
bool verbose =
true)
override;
337 faces.getMbScanLineRenderer().setMaskBorder(maskBorder);
360 #ifdef VISP_HAVE_OGRE
361 faces.getOgreContext()->setWindowName(
"MBT Klt");
374 for (std::list<vpMbtDistanceKltPoints *>::const_iterator it = kltPolygons.begin(); it != kltPolygons.end(); ++it)
375 (*it)->useScanLine = v;
390 std::cerr <<
"This option is not yet implemented in vpMbKltTracker, "
391 "projection error computation set to false."
395 void setUseKltTracking(
const std::string &name,
const bool &useKltTracking);
440 faces.getMbScanLineRenderer().setMaskBorder(maskBorder);
460 virtual std::vector<std::vector<double> > getFeaturesForDisplayKlt();
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionalities.
Implementation of an homogeneous matrix and operations on such kind of matrices.
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.
std::vector< cv::Point2f > getFeatures() const
Get the list of current features.
Implementation of a matrix and operations on matrices.
Model based tracker using only KLT.
virtual void setProjectionErrorComputation(const bool &flag) override
std::list< vpMbtDistanceKltCylinder * > kltCylinders
vpColVector m_error_klt
(s - s*)
vpHomogeneousMatrix c0Mo
Initial pose.
virtual vpColVector getError() const override
void setMaskBorder(const unsigned int &e)
vpHomogeneousMatrix ctTc0
std::list< vpMbtDistanceKltPoints * > kltPolygons
double getKltThresholdAcceptation() const
virtual std::list< vpMbtDistanceKltPoints * > & getFeaturesKlt()
virtual void setScanLineVisibilityTest(const bool &v) override
cv::Mat cur
Temporary OpenCV image for fast conversion.
unsigned int getKltMaskBorder() const
virtual std::list< vpMbtDistanceCircle * > & getFeaturesCircle()
std::list< vpMbtDistanceCircle * > circles_disp
Vector of the circles used here only to display the full model.
vpColVector m_weightedError_klt
Weighted error.
vpKltOpencv tracker
Points tracker.
virtual vpColVector getRobustWeights() const override
virtual std::list< vpMbtDistanceKltCylinder * > & getFeaturesKltCylinder()
std::vector< cv::Point2f > getKltPoints() const
unsigned int getMaskBorder() const
vpKltOpencv getKltOpencv() const
void setKltThresholdAcceptation(double th)
void setThresholdAcceptation(double th)
vpRobust m_robust_klt
Robust.
int getKltNbPoints() const
double getThresholdAcceptation() const
unsigned int maskBorder
Erosion of the mask.
unsigned int m_nbFaceUsed
vpColVector m_w_klt
Robust weights.
std::vector< std::vector< double > > m_featuresToBeDisplayedKlt
Display features.
virtual void setOgreVisibilityTest(const bool &v) override
vpMatrix m_L_klt
Interaction matrix.
void setKltMaskBorder(const unsigned int &e)
int getNbKltPoints() const
Main methods for a model-based tracker.
virtual void track(const vpImage< unsigned char > &I)=0
virtual void resetTracker()=0
virtual void init(const vpImage< unsigned char > &I)=0
virtual std::vector< std::vector< double > > getModelForDisplay(unsigned int width, unsigned int height, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, bool displayFullModel=false)=0
virtual void initFaceFromLines(vpMbtPolygon &polygon)=0
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace=0, const std::string &name="")=0
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, double radius, int idFace=0, const std::string &name="")=0
virtual void setCameraParameters(const vpCameraParameters &cam)
virtual void setScanLineVisibilityTest(const bool &v)
virtual void setOgreVisibilityTest(const bool &v)
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
virtual void computeVVSInteractionMatrixAndResidu()=0
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)=0
virtual void computeVVSInit()=0
virtual void testTracking()=0
virtual void initFaceFromCorners(vpMbtPolygon &polygon)=0
virtual void loadConfigFile(const std::string &configFile, bool verbose=true)
Implementation of a polygon of the model used by the model-based tracker.
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Contains an M-estimator and various influence function.