46 #ifndef vpMbEdgeTracker_HH 47 #define vpMbEdgeTracker_HH 49 #include <visp3/core/vpPoint.h> 50 #include <visp3/mbt/vpMbTracker.h> 51 #include <visp3/mbt/vpMbtDistanceCircle.h> 52 #include <visp3/mbt/vpMbtDistanceCylinder.h> 53 #include <visp3/mbt/vpMbtDistanceLine.h> 54 #include <visp3/mbt/vpMbtMeLine.h> 55 #include <visp3/me/vpMe.h> 62 #if defined(VISP_HAVE_COIN3D) 64 #include <Inventor/VRMLnodes/SoVRMLCoordinate.h> 65 #include <Inventor/VRMLnodes/SoVRMLGroup.h> 66 #include <Inventor/VRMLnodes/SoVRMLIndexedFaceSet.h> 67 #include <Inventor/VRMLnodes/SoVRMLIndexedLineSet.h> 68 #include <Inventor/VRMLnodes/SoVRMLShape.h> 69 #include <Inventor/actions/SoGetMatrixAction.h> 70 #include <Inventor/actions/SoGetPrimitiveCountAction.h> 71 #include <Inventor/actions/SoSearchAction.h> 72 #include <Inventor/actions/SoToVRML2Action.h> 73 #include <Inventor/actions/SoWriteAction.h> 74 #include <Inventor/misc/SoChildList.h> 75 #include <Inventor/nodes/SoSeparator.h> 78 #ifdef VISP_HAVE_OPENCV 79 #if VISP_HAVE_OPENCV_VERSION >= 0x020101 80 #include <opencv2/core/core.hpp> 81 #include <opencv2/imgproc/imgproc.hpp> 82 #include <opencv2/imgproc/imgproc_c.h> 269 std::vector<std::list<vpMbtDistanceLine *> >
lines;
272 std::vector<std::list<vpMbtDistanceCircle *> >
circles;
275 std::vector<std::list<vpMbtDistanceCylinder *> >
cylinders;
301 std::vector<const vpImage<unsigned char> *>
Ipyramid;
343 const vpColor &col,
unsigned int thickness = 1,
bool displayFullModel =
false);
345 const vpColor &col,
unsigned int thickness = 1,
bool displayFullModel =
false);
347 void getLline(std::list<vpMbtDistanceLine *> &linesList,
unsigned int level = 0)
const;
348 void getLcircle(std::list<vpMbtDistanceCircle *> &circlesList,
unsigned int level = 0)
const;
349 void getLcylinder(std::list<vpMbtDistanceCylinder *> &cylindersList,
unsigned int level = 0)
const;
351 virtual std::vector<std::vector<double> >
getModelForDisplay(
unsigned int width,
unsigned int height,
354 bool displayFullModel=
false);
370 virtual unsigned int getNbPoints(
unsigned int level = 0)
const;
409 for (
unsigned int i = 0; i < scales.size(); i += 1) {
411 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[i].begin(); it != lines[i].end(); ++it) {
412 (*it)->setCameraParameters(
m_cam);
415 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[i].begin(); it != cylinders[i].end();
417 (*it)->setCameraParameters(
m_cam);
420 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[i].begin(); it != circles[i].end(); ++it) {
421 (*it)->setCameraParameters(
m_cam);
427 virtual void setClipping(
const unsigned int &flags);
444 #ifdef VISP_HAVE_OGRE 458 for (
unsigned int i = 0; i < scales.size(); i += 1) {
460 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[i].begin(); it != lines[i].end(); ++it) {
461 (*it)->useScanLine = v;
487 void setScales(
const std::vector<bool> &_scales);
499 const std::string &name =
"");
509 unsigned int lvl = 0);
520 void downScale(
const unsigned int _scale);
524 int idFace = 0,
const std::string &name =
"");
526 const std::string &name =
"");
529 unsigned int initMbtTracking(
unsigned int &nberrors_lines,
unsigned int &nberrors_cylinders,
530 unsigned int &nberrors_circles);
543 void upScale(
const unsigned int _scale);
void computeVVSFirstPhase(const vpImage< unsigned char > &I, unsigned int iter, double &count, unsigned int lvl=0)
void setWindowName(const Ogre::String &n)
Implementation of a matrix and operations on matrices.
virtual void setUseEdgeTracking(const std::string &name, const bool &useEdgeTracking)
void getLline(std::list< vpMbtDistanceLine *> &linesList, unsigned int level=0) const
vpCameraParameters m_cam
The camera parameters.
virtual std::vector< std::vector< double > > getFeaturesForDisplayEdge()
void setGoodMovingEdgesRatioThreshold(double threshold)
virtual void track(const vpImage< unsigned char > &I)=0
virtual void computeVVSInteractionMatrixAndResidu()=0
vpColVector m_error_edge
(s - s*)
virtual void computeVVSInit()=0
void upScale(const unsigned int _scale)
vpColVector m_weightedError_edge
Weighted error.
void addLine(vpPoint &p1, vpPoint &p2, int polygon=-1, std::string name="")
vpMbHiddenFaces< vpMbtPolygon > faces
Set of faces describing the object.
virtual void computeProjectionError()
Implementation of an homogeneous matrix and operations on such kind of matrices.
std::vector< std::list< vpMbtDistanceCylinder * > > cylinders
Vector of the tracked cylinders.
void getLcylinder(std::list< vpMbtDistanceCylinder *> &cylindersList, unsigned int level=0) const
virtual void loadConfigFile(const std::string &configFile)
Class to define colors available for display functionnalities.
vpColVector m_factor
Edge VVS variables.
virtual ~vpMbEdgeTracker()
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace=0, const std::string &name="")=0
std::vector< const vpImage< unsigned char > * > Ipyramid
vpColVector m_w_edge
Robust weights.
void reInitLevel(const unsigned int _lvl)
Hybrid stereo (or more) tracker based on moving-edges and keypoints tracked using KLT tracker...
virtual void setMovingEdge(const vpMe &moving_edge)
Make the complete tracking of an object by using its CAD model.
void removeCircle(const std::string &name)
void removeCylinder(const std::string &name)
vpMe me
The moving edges parameters.
void updateMovingEdge(const vpImage< unsigned char > &I)
virtual void resetTracker()=0
virtual void computeVVS()
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
void downScale(const unsigned int _scale)
Class that defines what is a point.
virtual void init(const vpImage< unsigned char > &I)=0
void getLcircle(std::list< vpMbtDistanceCircle *> &circlesList, unsigned int level=0) const
void addCylinder(const vpPoint &P1, const vpPoint &P2, double r, int idFace=-1, const std::string &name="")
virtual void setOgreVisibilityTest(const bool &v)
vpAROgre * getOgreContext()
vpRobust m_robust_edge
Robust.
std::vector< bool > scales
Vector of scale level to use for the multi-scale tracking.
virtual void addCircle(const vpPoint &P1, const vpPoint &P2, const vpPoint &P3, double r, const std::string &name="")
virtual void setScanLineVisibilityTest(const bool &v)
Implementation of a polygon of the model used by the model-based tracker.
void initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo)
virtual void getMovingEdge(vpMe &p_me) const
unsigned int nbFeaturesForProjErrorComputation
Number of features used in the computation of the projection error.
virtual void initFaceFromCorners(vpMbtPolygon &polygon)=0
Generic class defining intrinsic camera parameters.
double getGoodMovingEdgesRatioThreshold() const
Main methods for a model-based tracker.
virtual unsigned int initMbtTracking(std::map< std::string, const vpImage< unsigned char > *> &mapOfImages, unsigned int lvl)
virtual void computeVVSWeights(vpRobust &robust, const vpColVector &error, vpColVector &w)
virtual void initPyramid(const std::map< std::string, const vpImage< unsigned char > *> &mapOfImages, std::map< std::string, std::vector< const vpImage< unsigned char > *> > &pyramid)
void computeVVSFirstPhaseFactor(const vpImage< unsigned char > &I, unsigned int lvl=0)
vpColVector m_errorCylinders
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo)
vpColVector m_errorCircles
std::vector< std::list< vpMbtDistanceCircle * > > circles
Vector of the tracked circles.
virtual vpColVector getError() const
void addPolygon(const std::vector< vpPoint > &corners, int idFace=-1, const std::string &polygonName="", bool useLod=false, double minPolygonAreaThreshold=2500.0, double minLineLengthThreshold=50.0)
vpRobust m_robustCylinders
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 setScales(const std::vector< bool > &scales)
virtual void computeVVSFirstPhasePoseEstimation(unsigned int iter, bool &isoJoIdentity_)
virtual void setOgreVisibilityTest(const bool &v)
Implementation of column vector and the associated operations.
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, double radius, int idFace=0, const std::string &name="")=0
virtual vpColVector getRobustWeights() const
virtual void initFaceFromLines(vpMbtPolygon &polygon)=0
virtual void testTracking()=0
Contains an M-Estimator and various influence function.
void updateMovingEdgeWeights()
unsigned int nbvisiblepolygone
Number of polygon (face) currently visible.
virtual vpMe getMovingEdge() const
void visibleFace(const vpImage< unsigned char > &_I, const vpHomogeneousMatrix &_cMo, bool &newvisibleline)
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
std::vector< std::list< vpMbtDistanceLine * > > lines
virtual void setScanLineVisibilityTest(const bool &v)
virtual void setClipping(const unsigned int &flags)
virtual void setCameraParameters(const vpCameraParameters &cam)
vpMatrix m_L_edge
Interaction matrix.
void trackMovingEdge(const vpImage< unsigned char > &I)
virtual void setFarClippingDistance(const double &dist)
void removeLine(const std::string &name)
virtual void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo, bool verbose=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
Make the complete stereo (or more) tracking of an object by using its CAD model.
std::vector< bool > getScales() const
void displayFeaturesOnImage(const vpImage< unsigned char > &I)
std::vector< std::vector< double > > m_featuresToBeDisplayedEdge
Display features.
virtual unsigned int getNbPoints(unsigned int level=0) const
virtual void cleanPyramid(std::map< std::string, std::vector< const vpImage< unsigned char > *> > &pyramid)
virtual void setNearClippingDistance(const double &dist)