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/vpMbtDistanceCylinder.h>
58 #include <visp/vpXmlParser.h>
65 #if defined(VISP_HAVE_COIN)
67 #include <Inventor/nodes/SoSeparator.h>
68 #include <Inventor/VRMLnodes/SoVRMLIndexedFaceSet.h>
69 #include <Inventor/VRMLnodes/SoVRMLIndexedLineSet.h>
70 #include <Inventor/VRMLnodes/SoVRMLCoordinate.h>
71 #include <Inventor/actions/SoWriteAction.h>
72 #include <Inventor/actions/SoSearchAction.h>
73 #include <Inventor/misc/SoChildList.h>
74 #include <Inventor/actions/SoGetMatrixAction.h>
75 #include <Inventor/actions/SoGetPrimitiveCountAction.h>
76 #include <Inventor/actions/SoToVRML2Action.h>
77 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
78 #include <Inventor/VRMLnodes/SoVRMLShape.h>
81 #ifdef VISP_HAVE_OPENCV
82 # if VISP_HAVE_OPENCV_VERSION >= 0x020101
83 # include <opencv2/core/core.hpp>
84 # include <opencv2/imgproc/imgproc.hpp>
85 # include <opencv2/imgproc/imgproc_c.h>
91 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
92 # include <visp/vpList.h>
282 std::vector< std::list< vpMbtDistanceLine*> >
lines;
284 std::vector< std::list< vpMbtDistanceCylinder*> >
cylinders;
308 std::vector< const vpImage<unsigned char>* >
Ipyramid;
337 const vpColor& col ,
const unsigned int thickness=1,
const bool displayFullModel =
false);
339 const vpColor& col ,
const unsigned int thickness=1,
const bool displayFullModel =
false);
354 virtual inline unsigned int getClipping()
const {
return clippingFlag; }
373 virtual inline double getLambda()
const {
return lambda;}
375 void getLline(std::list<vpMbtDistanceLine *>& linesList,
const unsigned int level = 0);
376 void getLcylinder(std::list<vpMbtDistanceCylinder *>& cylindersList,
const unsigned int level = 0);
392 unsigned int getNbPoints(
const unsigned int level=0)
const;
393 unsigned int getNbPolygon()
const ;
405 void loadModel(
const std::string &cad_name);
447 for (
unsigned int i = 0; i < scales.size(); i += 1){
449 for(std::list<vpMbtDistanceLine*>::const_iterator it=lines[i].begin(); it!=lines[i].end(); ++it){
450 (*it)->setCameraParameters(cam);
453 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=cylinders[i].begin(); it!=cylinders[i].end(); ++it){
454 (*it)->setCameraParameters(cam);
460 virtual void setClipping(
const unsigned int &flags);
474 virtual void setFarClippingDistance(
const double &dist);
492 virtual inline void setLambda(
const double gain) {this->lambda = gain;}
494 void setMovingEdge(
const vpMe &me);
496 virtual void setNearClippingDistance(
const double &dist);
498 virtual void setOgreVisibilityTest(
const bool &v);
502 void setScales(
const std::vector<bool>& _scales);
507 void addCylinder(
const vpPoint &P1,
const vpPoint &P2,
const double r,
const std::string& name =
"");
508 void addLine(
vpPoint &p1,
vpPoint &p2,
int polygone = -1, std::string name =
"");
512 void downScale(
const unsigned int _scale);
515 virtual void initFaceFromCorners(
const std::vector<vpPoint>& _corners,
const unsigned int _indexFace = -1);
518 void reInitLevel(
const unsigned int _lvl);
520 void removeCylinder(
const std::string& name);
521 void removeLine(
const std::string& name);
525 void upScale(
const unsigned int _scale);
528 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
std::vector< bool > getScales() const
void setDisplayMovingEdges(const bool displayMe)
double distFarClip
Distance for near clipping.
unsigned int ncylinder
Index of the cylinder to add, and total number of polygon 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...
virtual void setAngleAppear(const double &a)
virtual void initFaceFromCorners(const std::vector< vpPoint > &corners, const unsigned int indexFace=-1)=0
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(...
virtual void setAngleDisappear(const double &a)
Class to define colors available for display functionnalities.
virtual double getFarClippingDistance() const
double distNearClip
Distance for near clipping.
Contains predetermined masks for sites and holds moving edges tracking parameters.
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)
double angleDisappears
Angle used to detect a face disappearance.
virtual double getAngleAppear() const
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 setFirstThreshold(const double threshold1)
double getFirstThreshold() const
virtual double getNearClippingDistance() const
bool useOgre
Use Ogre3d for visibility tests.
Class that defines what is a point.
virtual void init(const vpImage< unsigned char > &I)=0
int index_polygon
Index of the polygon to add, and total number of polygon extracted so far. Cannot be unsigned because...
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
virtual double getAngleDisappear() const
Generic class defining intrinsic camera parameters.
virtual void loadModel(const std::string &modelFile)
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...
double angleAppears
Angle used to detect a face appearance.
virtual void loadConfigFile(const std::string &configFile)=0
vpMbHiddenFaces< vpMbtPolygon > & getFaces()
virtual double getLambda() const
std::vector< std::list< vpMbtDistanceCylinder * > > cylinders
Vector of the tracked cylinders.
virtual void testTracking()=0
unsigned int nbvisiblepolygone
Number of polygon (face) currently visible.
virtual unsigned int getClipping() const
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
vpMbHiddenFaces< vpMbtPolygon > faces
Set of faces describing the object.
unsigned int nline
Index of the polygon to add, and total number of polygon extracted so far.
unsigned int clippingFlag
Flags specifying which clipping to used.
virtual void setLambda(const double gain)
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const unsigned int indexCylinder=0)=0