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> 260 std::vector<std::list<vpMbtDistanceLine *> >
lines;
263 std::vector<std::list<vpMbtDistanceCircle *> >
circles;
266 std::vector<std::list<vpMbtDistanceCylinder *> >
cylinders;
292 std::vector<const vpImage<unsigned char> *>
Ipyramid;
334 const vpColor &col,
unsigned int thickness = 1,
bool displayFullModel =
false);
336 const vpColor &col,
unsigned int thickness = 1,
bool displayFullModel =
false);
338 void getLline(std::list<vpMbtDistanceLine *> &linesList,
unsigned int level = 0)
const;
339 void getLcircle(std::list<vpMbtDistanceCircle *> &circlesList,
unsigned int level = 0)
const;
340 void getLcylinder(std::list<vpMbtDistanceCylinder *> &cylindersList,
unsigned int level = 0)
const;
342 virtual std::vector<std::vector<double> >
getModelForDisplay(
unsigned int width,
unsigned int height,
345 bool displayFullModel=
false);
361 virtual unsigned int getNbPoints(
unsigned int level = 0)
const;
384 virtual void loadConfigFile(
const std::string &configFile,
bool verbose=
true);
400 for (
unsigned int i = 0; i < scales.size(); i += 1) {
402 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[i].begin(); it != lines[i].end(); ++it) {
403 (*it)->setCameraParameters(m_cam);
406 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[i].begin(); it != cylinders[i].end();
408 (*it)->setCameraParameters(m_cam);
411 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[i].begin(); it != circles[i].end(); ++it) {
412 (*it)->setCameraParameters(m_cam);
418 virtual void setClipping(
const unsigned int &flags);
435 #ifdef VISP_HAVE_OGRE 436 faces.getOgreContext()->setWindowName(
"MBT Edge");
449 for (
unsigned int i = 0; i < scales.size(); i += 1) {
451 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[i].begin(); it != lines[i].end(); ++it) {
452 (*it)->useScanLine = v;
473 void setMovingEdge(
const vpMe &me);
478 void setScales(
const std::vector<bool> &_scales);
480 void setUseEdgeTracking(
const std::string &name,
const bool &useEdgeTracking);
490 const std::string &name =
"");
491 void addCylinder(
const vpPoint &P1,
const vpPoint &P2,
double r,
int idFace = -1,
const std::string &name =
"");
492 void addLine(
vpPoint &p1,
vpPoint &p2,
int polygon = -1, std::string name =
"");
500 unsigned int lvl = 0);
502 void computeVVSFirstPhasePoseEstimation(
unsigned int iter,
bool &isoJoIdentity_);
511 void downScale(
const unsigned int _scale);
512 virtual std::vector<std::vector<double> > getFeaturesForDisplayEdge();
515 int idFace = 0,
const std::string &name =
"");
517 const std::string &name =
"");
520 unsigned int initMbtTracking(
unsigned int &nberrors_lines,
unsigned int &nberrors_cylinders,
521 unsigned int &nberrors_circles);
524 void reInitLevel(
const unsigned int _lvl);
526 void removeCircle(
const std::string &name);
527 void removeCylinder(
const std::string &name);
528 void removeLine(
const std::string &name);
529 void resetMovingEdge();
533 void updateMovingEdgeWeights();
534 void upScale(
const unsigned int _scale);
Implementation of a matrix and operations on matrices.
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
vpColVector m_weightedError_edge
Weighted error.
Implementation of an homogeneous matrix and operations on such kind of matrices.
std::vector< std::list< vpMbtDistanceCylinder * > > cylinders
Vector of the tracked cylinders.
Class to define RGB colors available for display functionnalities.
vpColVector m_factor
Edge VVS variables.
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.
Make the complete tracking of an object by using its CAD model.
vpMe me
The moving edges parameters.
virtual void resetTracker()=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
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
virtual void init(const vpImage< unsigned char > &I)=0
virtual void setOgreVisibilityTest(const bool &v)
vpRobust m_robust_edge
Robust.
std::vector< bool > scales
Vector of scale level to use for the multi-scale tracking.
virtual void setScanLineVisibilityTest(const bool &v)
Implementation of a polygon of the model used by the model-based tracker.
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 void computeVVSWeights(vpRobust &robust, const vpColVector &error, vpColVector &w)
vpColVector m_errorCylinders
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 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.
unsigned int nbvisiblepolygone
Number of polygon (face) currently visible.
virtual vpMe getMovingEdge() const
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)
virtual void loadConfigFile(const std::string &configFile, bool verbose=true)
vpMatrix m_L_edge
Interaction matrix.
virtual void setFarClippingDistance(const double &dist)
std::vector< bool > getScales() const
std::vector< std::vector< double > > m_featuresToBeDisplayedEdge
Display features.
virtual void setNearClippingDistance(const double &dist)