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>
258 std::vector< std::list< vpMbtDistanceLine*> >
lines;
260 std::vector< std::list< vpMbtDistanceCylinder*> >
cylinders;
285 std::vector< const vpImage<unsigned char>* >
Ipyramid;
300 inline void setLambda(
const double lambda) {this->lambda = lambda;}
302 void setMovingEdge(
const vpMe &_me);
305 void loadModel(
const std::string &cad_name);
350 unsigned int getNbPoints(
const unsigned int _level=0);
351 vpMbtPolygon* getPolygon(
const unsigned int _index);
352 unsigned int getNbPolygon();
353 void getLline(std::list<vpMbtDistanceLine *>& linesList,
const unsigned int _level = 0);
354 void getLcylinder(std::list<vpMbtDistanceCylinder *>& cylindersList,
const unsigned int _level = 0);
356 void setScales(
const std::vector<bool>& _scales);
374 cameraInitialised =
true;
376 for (
unsigned int i = 0; i < scales.size(); i += 1){
378 for(std::list<vpMbtDistanceLine*>::const_iterator it=lines[i].begin(); it!=lines[i].end(); ++it){
379 (*it)->setCameraParameters(cam);
382 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=cylinders[i].begin(); it!=cylinders[i].end(); ++it){
383 (*it)->setCameraParameters(cam);
396 void addPolygon(vpMbtPolygon &p) ;
397 void addLine(
vpPoint &p1,
vpPoint &p2,
int polygone = -1, std::string name =
"");
398 void removeLine(
const std::string& name);
399 void addCylinder(
const vpPoint &P1,
const vpPoint &P2,
const double r,
const std::string& name =
"");
400 void removeCylinder(
const std::string& name);
401 virtual void initFaceFromCorners(
const std::vector<vpPoint>& _corners,
const unsigned int _indexFace = -1);
407 void reInitLevel(
const unsigned int _lvl);
408 void downScale(
const unsigned int _scale);
409 void upScale(
const unsigned int _scale);
412 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
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.
virtual void loadModel(const std::string &_modelFile)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Provide simple list management.
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(...
void getMovingEdge(vpMe &_me)
virtual void setCameraParameters(const vpCameraParameters &_cam)
Class to define colors available for display functionnalities.
bool displayMe
If true, the moving edges are displayed during the track() method.
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...
vpMe me
The moving edges parameters.
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)
virtual void track(const vpImage< unsigned char > &_I)=0
virtual void display(const vpImage< unsigned char > &_I, const vpHomogeneousMatrix &_cMo, const vpCameraParameters &_cam, const vpColor &_col, const unsigned int _l=1, const bool displayFullModel=false)=0
vpMbtHiddenFaces faces
Set of faces describing the object.
Class that defines what is a point.
int index_polygon
Index of the polygon to add, and total number of polygon extracted so far. Cannot be unsigned because...
std::vector< bool > scales
Vector of scale level to use for the multi-scale tracking.
Generic class defining intrinsic camera parameters.
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...
void setLambda(const double lambda)
double getFirstThreshold()
virtual void initCylinder(const vpPoint &_p1, const vpPoint _p2, const double _radius, const unsigned int _indexCylinder=0)=0
virtual void loadConfigFile(const std::string &_configFile)=0
std::vector< std::list< vpMbtDistanceCylinder * > > cylinders
Vector of the tracked cylinders.
virtual void init(const vpImage< unsigned char > &_I)=0
virtual void testTracking()=0
unsigned int nbvisiblepolygone
Number of polygon (face) currently visible.
virtual void initFaceFromCorners(const std::vector< vpPoint > &_corners, const unsigned int _indexFace=-1)=0
unsigned int nline
Index of the polygon to add, and total number of polygon extracted so far.