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;
328 const vpColor& col ,
const unsigned int thickness=1,
const bool displayFullModel =
false);
330 const vpColor& col ,
const unsigned int thickness=1,
const bool displayFullModel =
false);
342 void getLline(std::list<vpMbtDistanceLine *>& linesList,
const unsigned int level = 0);
343 void getLcylinder(std::list<vpMbtDistanceCylinder *>& cylindersList,
const unsigned int level = 0);
352 unsigned int getNbPoints(
const unsigned int level=0);
353 unsigned int getNbPolygon();
365 void loadModel(
const std::string &cad_name);
407 for (
unsigned int i = 0; i < scales.size(); i += 1){
409 for(std::list<vpMbtDistanceLine*>::const_iterator it=lines[i].begin(); it!=lines[i].end(); ++it){
410 (*it)->setCameraParameters(cam);
413 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=cylinders[i].begin(); it!=cylinders[i].end(); ++it){
414 (*it)->setCameraParameters(cam);
448 inline void setLambda(
const double lambda) {this->lambda = lambda;}
450 void setMovingEdge(
const vpMe &me);
452 virtual void setOgreVisibilityTest(
const bool &v);
456 void setScales(
const std::vector<bool>& _scales);
461 void addCylinder(
const vpPoint &P1,
const vpPoint &P2,
const double r,
const std::string& name =
"");
462 void addLine(
vpPoint &p1,
vpPoint &p2,
int polygone = -1, std::string name =
"");
466 void downScale(
const unsigned int _scale);
469 virtual void initFaceFromCorners(
const std::vector<vpPoint>& _corners,
const unsigned int _indexFace = -1);
472 void reInitLevel(
const unsigned int _lvl);
474 void removeCylinder(
const std::string& name);
475 void removeLine(
const std::string& name);
479 void upScale(
const unsigned int _scale);
std::vector< bool > getScales() const
void setDisplayMovingEdges(const bool displayMe)
unsigned int ncylinder
Index of the cylinder to add, and total number of polygon extracted so far.
void getMovingEdge(vpMe &me)
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 outsied of the downScale() and upScale(...
virtual void setAngleDisappear(const double &a)
Class to define colors available for display functionnalities.
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 compted in the init() and in the tr...
double angleDisappears
Angle used to detect a face disparition.
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)
bool useOgre
Use Ogre3d for visibility tests.
Class that defines what is a point.
vpCameraParameters cam
The camera parameters.
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.
virtual double getAngleAppear()
virtual double getAngleDisappear()
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...
virtual void initCylinder(const vpPoint &p1, const vpPoint p2, const double radius, const unsigned int indexCylinder=0)=0
double angleAppears
Angle used to detect a face apparition.
virtual void loadConfigFile(const std::string &configFile)=0
void setLambda(const double lambda)
double getFirstThreshold()
vpMbHiddenFaces< vpMbtPolygon > & getFaces()
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 void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
virtual void setCameraParameters(const vpCameraParameters &cam)
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.