49 #ifndef vpMbEdgeTracker_HH
50 #define vpMbEdgeTracker_HH
52 #include <visp/vpPoint.h>
53 #include <visp/vpMbTracker.h>
54 #include <visp/vpMe.h>
55 #include <visp/vpMbtMeLine.h>
56 #include <visp/vpMbtDistanceLine.h>
57 #include <visp/vpMbtDistanceCircle.h>
58 #include <visp/vpMbtDistanceCylinder.h>
59 #include <visp/vpXmlParser.h>
66 #if defined(VISP_HAVE_COIN)
68 #include <Inventor/nodes/SoSeparator.h>
69 #include <Inventor/VRMLnodes/SoVRMLIndexedFaceSet.h>
70 #include <Inventor/VRMLnodes/SoVRMLIndexedLineSet.h>
71 #include <Inventor/VRMLnodes/SoVRMLCoordinate.h>
72 #include <Inventor/actions/SoWriteAction.h>
73 #include <Inventor/actions/SoSearchAction.h>
74 #include <Inventor/misc/SoChildList.h>
75 #include <Inventor/actions/SoGetMatrixAction.h>
76 #include <Inventor/actions/SoGetPrimitiveCountAction.h>
77 #include <Inventor/actions/SoToVRML2Action.h>
78 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
79 #include <Inventor/VRMLnodes/SoVRMLShape.h>
82 #ifdef VISP_HAVE_OPENCV
83 # if VISP_HAVE_OPENCV_VERSION >= 0x020101
84 # include <opencv2/core/core.hpp>
85 # include <opencv2/imgproc/imgproc.hpp>
86 # include <opencv2/imgproc/imgproc_c.h>
279 std::vector< std::list< vpMbtDistanceLine*> >
lines;
282 std::vector< std::list< vpMbtDistanceCircle*> >
circles;
285 std::vector< std::list< vpMbtDistanceCylinder*> >
cylinders;
306 std::vector< const vpImage<unsigned char>* >
Ipyramid;
317 const vpColor& col ,
const unsigned int thickness=1,
const bool displayFullModel =
false);
319 const vpColor& col ,
const unsigned int thickness=1,
const bool displayFullModel =
false);
326 virtual inline double getLambda()
const {
return lambda;}
328 void getLline(std::list<vpMbtDistanceLine *>& linesList,
const unsigned int level = 0);
329 void getLcircle(std::list<vpMbtDistanceCircle *>& circlesList,
const unsigned int level = 0);
330 void getLcylinder(std::list<vpMbtDistanceCylinder *>& cylindersList,
const unsigned int level = 0);
345 unsigned int getNbPoints(
const unsigned int level=0)
const;
366 const bool verbose=
false);
368 const bool verbose=
false);
379 for (
unsigned int i = 0; i < scales.size(); i += 1){
381 for(std::list<vpMbtDistanceLine*>::const_iterator it=lines[i].begin(); it!=lines[i].end(); ++it){
382 (*it)->setCameraParameters(cam);
385 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=cylinders[i].begin(); it!=cylinders[i].end(); ++it){
386 (*it)->setCameraParameters(cam);
389 for(std::list<vpMbtDistanceCircle*>::const_iterator it=circles[i].begin(); it!=circles[i].end(); ++it){
390 (*it)->setCameraParameters(cam);
396 virtual void setClipping(
const unsigned int &flags);
411 #ifdef VISP_HAVE_OGRE
412 faces.getOgreContext()->setWindowName(
"MBT Edge");
435 virtual inline void setLambda(
const double gain) {this->lambda = gain;}
437 void setMovingEdge(
const vpMe &me);
441 void setScales(
const std::vector<bool>& _scales);
447 void addCircle(
const vpPoint &P1,
const vpPoint &P2,
const vpPoint &P3,
const double r,
int idFace = -1,
const std::string& name =
"");
448 void addCylinder(
const vpPoint &P1,
const vpPoint &P2,
const double r,
int idFace = -1,
const std::string& name =
"");
449 void addLine(
vpPoint &p1,
vpPoint &p2,
int polygon = -1, std::string name =
"");
453 void downScale(
const unsigned int _scale);
456 const int idFace=0,
const std::string &name=
"");
458 const std::string &name=
"");
463 void reInitLevel(
const unsigned int _lvl);
465 void removeCircle(
const std::string& name);
466 void removeCylinder(
const std::string& name);
467 void removeLine(
const std::string& name);
471 void upScale(
const unsigned int _scale);
474 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
std::vector< bool > getScales() const
unsigned int ncylinder
Index of the cylinder to add, and total number of cylinders extracted so far.
virtual void track(const vpImage< unsigned char > &I)=0
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
double lambda
The gain of the virtual visual servoing stage.
unsigned int scaleLevel
Current scale level used. This attribute must not be modified outside of the downScale() and upScale(...
std::vector< std::list< vpMbtDistanceCircle * > > circles
Vector of the tracked circles.
Class to define colors available for display functionnalities.
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius, const int idFace=0, const std::string &name="")=0
unsigned int ncircle
Index of the circle to add, and total number of circles extracted so far.
Contains predetermined masks for sites and holds moving edges tracking parameters.
vp_deprecated void setFirstThreshold(const double threshold1)
Make the complete tracking of an object by using its CAD model.
std::vector< const vpImage< unsigned char > * > Ipyramid
Pyramid of image associated to the current image. This pyramid is computed in the init() and in the t...
virtual void setCameraParameters(const vpCameraParameters &camera)
vpMe me
The moving edges parameters.
virtual void resetTracker()=0
std::vector< std::list< vpMbtDistanceLine * > > lines
Vector of list of all the lines tracked (each line is linked to a list of moving edges). Each element of the vector is for a scale (element 0 = level 0 = no subsampling).
void setGoodMovingEdgesRatioThreshold(const double threshold)
Class that defines what is a point.
virtual void init(const vpImage< unsigned char > &I)=0
virtual void setOgreVisibilityTest(const bool &v)
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
std::vector< bool > scales
Vector of scale level to use for the multi-scale tracking.
Implementation of a polygon of the model used by the model-based tracker.
void getMovingEdge(vpMe &p_me) const
vpMe getMovingEdge() const
virtual void initFaceFromCorners(vpMbtPolygon &polygon)=0
Generic class defining intrinsic camera parameters.
vp_deprecated double getFirstThreshold() const
Main methods for a model-based tracker.
double percentageGdPt
Percentage of good points over total number of points below which tracking is supposed to have failed...
virtual void loadConfigFile(const std::string &configFile)=0
virtual double getLambda() const
virtual void setOgreVisibilityTest(const bool &v)
double getGoodMovingEdgesRatioThreshold() const
std::vector< std::list< vpMbtDistanceCylinder * > > cylinders
Vector of the tracked cylinders.
virtual void initFaceFromLines(vpMbtPolygon &polygon)=0
virtual void testTracking()=0
unsigned int nbvisiblepolygone
Number of polygon (face) currently visible.
vp_deprecated void setDisplayMovingEdges(const bool displayMe)
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
virtual void setClipping(const unsigned int &flags)
void addPolygon(const std::vector< vpPoint > &corners, const int idFace=-1, const std::string &polygonName="", const bool useLod=false, const double minPolygonAreaThreshold=2500.0, const double minLineLengthThreshold=50.0)
unsigned int nline
Index of the polygon to add, and total number of polygon extracted so far.
virtual void setFarClippingDistance(const double &dist)
virtual void setLambda(const double gain)
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace=0, const std::string &name="")=0
virtual void setNearClippingDistance(const double &dist)