Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpMbGenericTracker.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Generic model-based tracker.
33  *
34  *****************************************************************************/
40 #ifndef _vpMbGenericTracker_h_
41 #define _vpMbGenericTracker_h_
42 
43 #include <visp3/mbt/vpMbDepthDenseTracker.h>
44 #include <visp3/mbt/vpMbDepthNormalTracker.h>
45 #include <visp3/mbt/vpMbEdgeTracker.h>
46 #include <visp3/mbt/vpMbKltTracker.h>
47 
80 class VISP_EXPORT vpMbGenericTracker : public vpMbTracker
81 {
82 public:
84  EDGE_TRACKER = 1 << 0,
85 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
86  KLT_TRACKER = 1 << 1,
87 #endif
88  DEPTH_NORMAL_TRACKER = 1 << 2,
89  DEPTH_DENSE_TRACKER = 1 << 3
90  };
91 
93  vpMbGenericTracker(const unsigned int nbCameras, const int trackerType = EDGE_TRACKER);
94  explicit vpMbGenericTracker(const std::vector<int> &trackerTypes);
95  vpMbGenericTracker(const std::vector<std::string> &cameraNames, const std::vector<int> &trackerTypes);
96 
97  virtual ~vpMbGenericTracker();
98 
100  const vpCameraParameters &_cam);
101 
102  virtual void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
103  const vpColor &col, const unsigned int thickness = 1, const bool displayFullModel = false);
104  virtual void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
105  const vpColor &col, const unsigned int thickness = 1, const bool displayFullModel = false);
106 
107  virtual void display(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
108  const vpHomogeneousMatrix &c1Mo, const vpHomogeneousMatrix &c2Mo, const vpCameraParameters &cam1,
109  const vpCameraParameters &cam2, const vpColor &color, const unsigned int thickness = 1,
110  const bool displayFullModel = false);
111  virtual void display(const vpImage<vpRGBa> &I1, const vpImage<vpRGBa> &I2, const vpHomogeneousMatrix &c1Mo,
112  const vpHomogeneousMatrix &c2Mo, const vpCameraParameters &cam1, const vpCameraParameters &cam2,
113  const vpColor &color, const unsigned int thickness = 1, const bool displayFullModel = false);
114 
115  virtual void display(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
116  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
117  const std::map<std::string, vpCameraParameters> &mapOfCameraParameters, const vpColor &col,
118  const unsigned int thickness = 1, const bool displayFullModel = false);
119  virtual void display(const std::map<std::string, const vpImage<vpRGBa> *> &mapOfImages,
120  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
121  const std::map<std::string, vpCameraParameters> &mapOfCameraParameters, const vpColor &col,
122  const unsigned int thickness = 1, const bool displayFullModel = false);
123 
124  virtual std::vector<std::string> getCameraNames() const;
125 
127  virtual void getCameraParameters(vpCameraParameters &cam1, vpCameraParameters &cam2) const;
128  virtual void getCameraParameters(std::map<std::string, vpCameraParameters> &mapOfCameraParameters) const;
129 
130  virtual std::map<std::string, int> getCameraTrackerTypes() const;
131 
133  virtual void getClipping(unsigned int &clippingFlag1, unsigned int &clippingFlag2) const;
134  virtual void getClipping(std::map<std::string, unsigned int> &mapOfClippingFlags) const;
135 
136  virtual inline vpColVector getError() const { return m_error; }
137 
139  virtual vpMbHiddenFaces<vpMbtPolygon> &getFaces(const std::string &cameraName);
140 
141 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
142  virtual std::list<vpMbtDistanceCircle *> &getFeaturesCircle();
143  virtual std::list<vpMbtDistanceKltCylinder *> &getFeaturesKltCylinder();
144  virtual std::list<vpMbtDistanceKltPoints *> &getFeaturesKlt();
145 #endif
146 
147  virtual double getGoodMovingEdgesRatioThreshold() const;
148 
149 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
150  virtual std::vector<vpImagePoint> getKltImagePoints() const;
151  virtual std::map<int, vpImagePoint> getKltImagePointsWithId() const;
152 
153  virtual unsigned int getKltMaskBorder() const;
154  virtual int getKltNbPoints() const;
155 
156  virtual vpKltOpencv getKltOpencv() const;
157  virtual void getKltOpencv(vpKltOpencv &klt1, vpKltOpencv &klt2) const;
158  virtual void getKltOpencv(std::map<std::string, vpKltOpencv> &mapOfKlts) const;
159 
160 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
161  virtual std::vector<cv::Point2f> getKltPoints() const;
162 #endif
163 
164  virtual double getKltThresholdAcceptation() const;
165 #endif
166 
167  virtual void getLcircle(std::list<vpMbtDistanceCircle *> &circlesList, const unsigned int level = 0) const;
168  virtual void getLcircle(const std::string &cameraName, std::list<vpMbtDistanceCircle *> &circlesList,
169  const unsigned int level = 0) const;
170  virtual void getLcylinder(std::list<vpMbtDistanceCylinder *> &cylindersList, const unsigned int level = 0) const;
171  virtual void getLcylinder(const std::string &cameraName, std::list<vpMbtDistanceCylinder *> &cylindersList,
172  const unsigned int level = 0) const;
173  virtual void getLline(std::list<vpMbtDistanceLine *> &linesList, const unsigned int level = 0) const;
174  virtual void getLline(const std::string &cameraName, std::list<vpMbtDistanceLine *> &linesList,
175  const unsigned int level = 0) const;
176 
177  virtual vpMe getMovingEdge() const;
178  virtual void getMovingEdge(vpMe &me1, vpMe &me2) const;
179  virtual void getMovingEdge(std::map<std::string, vpMe> &mapOfMovingEdges) const;
180 
181  virtual unsigned int getNbPoints(const unsigned int level = 0) const;
182  virtual void getNbPoints(std::map<std::string, unsigned int> &mapOfNbPoints, const unsigned int level = 0) const;
183 
184  virtual inline unsigned int getNbPolygon() const;
185  virtual void getNbPolygon(std::map<std::string, unsigned int> &mapOfNbPolygons) const;
186 
187  virtual vpMbtPolygon *getPolygon(const unsigned int index);
188  virtual vpMbtPolygon *getPolygon(const std::string &cameraName, const unsigned int index);
189 
190  virtual std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > >
191  getPolygonFaces(const bool orderPolygons = true, const bool useVisibility = true, const bool clipPolygon = false);
192  virtual void getPolygonFaces(std::map<std::string, std::vector<vpPolygon> > &mapOfPolygons,
193  std::map<std::string, std::vector<std::vector<vpPoint> > > &mapOfPoints,
194  const bool orderPolygons = true, const bool useVisibility = true,
195  const bool clipPolygon = false);
196 
197  using vpMbTracker::getPose;
198  virtual void getPose(vpHomogeneousMatrix &c1Mo, vpHomogeneousMatrix &c2Mo) const;
199  virtual void getPose(std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses) const;
200 
201  virtual inline vpColVector getRobustWeights() const { return m_w; }
202 
203  virtual int getTrackerType() const;
204 
205  virtual void init(const vpImage<unsigned char> &I);
206 
207 #ifdef VISP_HAVE_MODULE_GUI
209  virtual void initClick(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
210  const std::string &initFile1, const std::string &initFile2, const bool displayHelp = false,
212  virtual void initClick(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
213  const std::map<std::string, std::string> &mapOfInitFiles, const bool displayHelp = false,
214  const std::map<std::string, vpHomogeneousMatrix> &mapOfT=std::map<std::string, vpHomogeneousMatrix>());
215 #endif
216 
218  virtual void initFromPoints(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
219  const std::string &initFile1, const std::string &initFile2);
220  virtual void initFromPoints(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
221  const std::map<std::string, std::string> &mapOfInitPoints);
222 
224  virtual void initFromPose(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
225  const std::string &initFile1, const std::string &initFile2);
226  virtual void initFromPose(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
227  const std::map<std::string, std::string> &mapOfInitPoses);
228 
229  virtual void initFromPose(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
230  const vpHomogeneousMatrix &c1Mo, const vpHomogeneousMatrix &c2Mo);
231  virtual void initFromPose(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
232  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses);
233 
234  virtual void loadConfigFile(const std::string &configFile);
235  virtual void loadConfigFile(const std::string &configFile1, const std::string &configFile2);
236  virtual void loadConfigFile(const std::map<std::string, std::string> &mapOfConfigFiles);
237 
238  virtual void loadModel(const std::string &modelFile, const bool verbose = false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix());
239  virtual void loadModel(const std::string &modelFile1, const std::string &modelFile2, const bool verbose = false,
241  virtual void loadModel(const std::map<std::string, std::string> &mapOfModelFiles, const bool verbose = false,
242  const std::map<std::string, vpHomogeneousMatrix> &mapOfT=std::map<std::string, vpHomogeneousMatrix>());
243 
244  virtual void reInitModel(const vpImage<unsigned char> &I, const std::string &cad_name,
245  const vpHomogeneousMatrix &cMo_, const bool verbose = false,
247  virtual void reInitModel(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
248  const std::string &cad_name1, const std::string &cad_name2, const vpHomogeneousMatrix &c1Mo,
249  const vpHomogeneousMatrix &c2Mo, const bool verbose = false,
251  virtual void reInitModel(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
252  const std::map<std::string, std::string> &mapOfModelFiles,
253  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
254  const bool verbose = false,
255  const std::map<std::string, vpHomogeneousMatrix> &mapOfT=std::map<std::string, vpHomogeneousMatrix>());
256 
257  virtual void resetTracker();
258 
259  virtual void setAngleAppear(const double &a);
260  virtual void setAngleAppear(const double &a1, const double &a2);
261  virtual void setAngleAppear(const std::map<std::string, double> &mapOfAngles);
262 
263  virtual void setAngleDisappear(const double &a);
264  virtual void setAngleDisappear(const double &a1, const double &a2);
265  virtual void setAngleDisappear(const std::map<std::string, double> &mapOfAngles);
266 
267  virtual void setCameraParameters(const vpCameraParameters &camera);
268  virtual void setCameraParameters(const vpCameraParameters &camera1, const vpCameraParameters &camera2);
269  virtual void setCameraParameters(const std::map<std::string, vpCameraParameters> &mapOfCameraParameters);
270 
271  virtual void setCameraTransformationMatrix(const std::string &cameraName,
272  const vpHomogeneousMatrix &cameraTransformationMatrix);
273  virtual void
274  setCameraTransformationMatrix(const std::map<std::string, vpHomogeneousMatrix> &mapOfTransformationMatrix);
275 
276  virtual void setClipping(const unsigned int &flags);
277  virtual void setClipping(const unsigned int &flags1, const unsigned int &flags2);
278  virtual void setClipping(const std::map<std::string, unsigned int> &mapOfClippingFlags);
279 
280  virtual void setDepthDenseFilteringMaxDistance(const double maxDistance);
281  virtual void setDepthDenseFilteringMethod(const int method);
282  virtual void setDepthDenseFilteringMinDistance(const double minDistance);
283  virtual void setDepthDenseFilteringOccupancyRatio(const double occupancyRatio);
284  virtual void setDepthDenseSamplingStep(const unsigned int stepX, const unsigned int stepY);
285 
286  virtual void setDepthNormalFaceCentroidMethod(const vpMbtFaceDepthNormal::vpFaceCentroidType &method);
287  virtual void setDepthNormalFeatureEstimationMethod(const vpMbtFaceDepthNormal::vpFeatureEstimationType &method);
288  virtual void setDepthNormalPclPlaneEstimationMethod(const int method);
289  virtual void setDepthNormalPclPlaneEstimationRansacMaxIter(const int maxIter);
290  virtual void setDepthNormalPclPlaneEstimationRansacThreshold(const double thresold);
291  virtual void setDepthNormalSamplingStep(const unsigned int stepX, const unsigned int stepY);
292 
293  virtual void setDisplayFeatures(const bool displayF);
294 
295  virtual void setFarClippingDistance(const double &dist);
296  virtual void setFarClippingDistance(const double &dist1, const double &dist2);
297  virtual void setFarClippingDistance(const std::map<std::string, double> &mapOfClippingDists);
298 
299  virtual void setFeatureFactors(const std::map<vpTrackerType, double> &mapOfFeatureFactors);
300 
301  virtual void setGoodMovingEdgesRatioThreshold(const double threshold);
302 
303 #ifdef VISP_HAVE_OGRE
304  virtual void setGoodNbRayCastingAttemptsRatio(const double &ratio);
305  virtual void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts);
306 #endif
307 
308 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
309  virtual void setKltMaskBorder(const unsigned int &e);
310  virtual void setKltMaskBorder(const unsigned int &e1, const unsigned int &e2);
311  virtual void setKltMaskBorder(const std::map<std::string, unsigned int> &mapOfErosions);
312 
313  virtual void setKltOpencv(const vpKltOpencv &t);
314  virtual void setKltOpencv(const vpKltOpencv &t1, const vpKltOpencv &t2);
315  virtual void setKltOpencv(const std::map<std::string, vpKltOpencv> &mapOfKlts);
316 
317  virtual void setKltThresholdAcceptation(const double th);
318 
319 #endif
320 
321  virtual void setLod(const bool useLod, const std::string &name = "");
322 
323  virtual void setMask(const vpImage<bool> &mask);
324 
325  virtual void setMinLineLengthThresh(const double minLineLengthThresh, const std::string &name = "");
326  virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name = "");
327 
328  virtual void setMovingEdge(const vpMe &me);
329  virtual void setMovingEdge(const vpMe &me1, const vpMe &me2);
330  virtual void setMovingEdge(const std::map<std::string, vpMe> &mapOfMe);
331 
332  virtual void setNearClippingDistance(const double &dist);
333  virtual void setNearClippingDistance(const double &dist1, const double &dist2);
334  virtual void setNearClippingDistance(const std::map<std::string, double> &mapOfDists);
335 
336  virtual void setOgreShowConfigDialog(const bool showConfigDialog);
337  virtual void setOgreVisibilityTest(const bool &v);
338 
339  virtual void setOptimizationMethod(const vpMbtOptimizationMethod &opt);
340 
341  virtual void setPose(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cdMo);
342  virtual void setPose(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
343  const vpHomogeneousMatrix &c1Mo, const vpHomogeneousMatrix &c2Mo);
344  virtual void setPose(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
345  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses);
346 
347  virtual void setProjectionErrorComputation(const bool &flag);
348 
349  virtual void setProjectionErrorDisplay(const bool display);
350  virtual void setProjectionErrorDisplayArrowLength(const unsigned int length);
351  virtual void setProjectionErrorDisplayArrowThickness(const unsigned int thickness);
352 
353  virtual void setReferenceCameraName(const std::string &referenceCameraName);
354 
355  virtual void setScanLineVisibilityTest(const bool &v);
356 
357  virtual void setTrackerType(const int type);
358  virtual void setTrackerType(const std::map<std::string, int> &mapOfTrackerTypes);
359 
360  virtual void setUseDepthDenseTracking(const std::string &name, const bool &useDepthDenseTracking);
361  virtual void setUseDepthNormalTracking(const std::string &name, const bool &useDepthNormalTracking);
362  virtual void setUseEdgeTracking(const std::string &name, const bool &useEdgeTracking);
363 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
364  virtual void setUseKltTracking(const std::string &name, const bool &useKltTracking);
365 #endif
366 
367  virtual void testTracking();
368 
369  virtual void track(const vpImage<unsigned char> &I);
370  virtual void track(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2);
371  virtual void track(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages);
372 #ifdef VISP_HAVE_PCL
373  virtual void track(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
374  std::map<std::string, pcl::PointCloud<pcl::PointXYZ>::ConstPtr> &mapOfPointClouds);
375 #endif
376  virtual void track(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
377  std::map<std::string, const std::vector<vpColVector> *> &mapOfPointClouds,
378  std::map<std::string, unsigned int> &mapOfPointCloudWidths,
379  std::map<std::string, unsigned int> &mapOfPointCloudHeights);
380 
381 protected:
382  virtual void computeProjectionError();
383 
384  virtual void computeVVS(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages);
385 
386  virtual void computeVVSInit();
387  virtual void computeVVSInit(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages);
389  virtual void computeVVSInteractionMatrixAndResidu(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
390  std::map<std::string, vpVelocityTwistMatrix> &mapOfVelocityTwist);
392  virtual void computeVVSWeights();
393 
394  virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius,
395  const int idFace = 0, const std::string &name = "");
396 
397  virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace = 0,
398  const std::string &name = "");
399 
400  virtual void initFaceFromCorners(vpMbtPolygon &polygon);
401 
402  virtual void initFaceFromLines(vpMbtPolygon &polygon);
403 
404 #ifdef VISP_HAVE_PCL
405  virtual void preTracking(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
406  std::map<std::string, pcl::PointCloud<pcl::PointXYZ>::ConstPtr> &mapOfPointClouds);
407 #endif
408  virtual void preTracking(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
409  std::map<std::string, const std::vector<vpColVector> *> &mapOfPointClouds,
410  std::map<std::string, unsigned int> &mapOfPointCloudWidths,
411  std::map<std::string, unsigned int> &mapOfPointCloudHeights);
412 
413 private:
414  class TrackerWrapper : public vpMbEdgeTracker,
415 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
416  public vpMbKltTracker,
417 #endif
418  public vpMbDepthNormalTracker,
419  public vpMbDepthDenseTracker
420  {
421  friend class vpMbGenericTracker;
422 
423  public:
427  vpMatrix m_L;
429  int m_trackerType;
434 
435  TrackerWrapper();
436  explicit TrackerWrapper(const int trackerType);
437 
438  virtual ~TrackerWrapper();
439 
440  virtual inline vpColVector getError() const { return m_error; }
441 
442  virtual inline vpColVector getRobustWeights() const { return m_w; }
443 
444  virtual inline int getTrackerType() const { return m_trackerType; }
445 
446  virtual void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
447  const vpColor &col, const unsigned int thickness = 1, const bool displayFullModel = false);
448  virtual void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
449  const vpColor &col, const unsigned int thickness = 1, const bool displayFullModel = false);
450 
451  virtual void init(const vpImage<unsigned char> &I);
452 
453  virtual void loadConfigFile(const std::string &configFile);
454 
455  virtual void reInitModel(const vpImage<unsigned char> &I, const std::string &cad_name,
456  const vpHomogeneousMatrix &cMo_, const bool verbose = false,
458 
459  virtual void resetTracker();
460 
461  virtual void setCameraParameters(const vpCameraParameters &camera);
462 
463  virtual void setClipping(const unsigned int &flags);
464 
465  virtual void setFarClippingDistance(const double &dist);
466 
467  virtual void setNearClippingDistance(const double &dist);
468 
469  virtual void setOgreVisibilityTest(const bool &v);
470 
471  virtual void setPose(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cdMo);
472 
473  virtual void setProjectionErrorComputation(const bool &flag);
474 
475  virtual void setScanLineVisibilityTest(const bool &v);
476 
477  virtual void setTrackerType(const int type);
478 
479  virtual void testTracking();
480 
481  virtual void track(const vpImage<unsigned char> &I);
482 #ifdef VISP_HAVE_PCL
485  virtual void track(const vpImage<unsigned char> *const ptr_I = NULL,
486  const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud = nullptr);
487 #endif
488 
489  protected:
490  virtual void computeVVS(const vpImage<unsigned char> *const ptr_I);
491  virtual void computeVVSInit();
492  virtual void computeVVSInit(const vpImage<unsigned char> *const ptr_I);
495  virtual void computeVVSInteractionMatrixAndResidu(const vpImage<unsigned char> *const ptr_I);
497  virtual void computeVVSWeights();
498 
499  virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius,
500  const int idFace = 0, const std::string &name = "");
501 
502  virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace = 0,
503  const std::string &name = "");
504 
505  virtual void initFaceFromCorners(vpMbtPolygon &polygon);
506  virtual void initFaceFromLines(vpMbtPolygon &polygon);
507 
508  virtual void initMbtTracking(const vpImage<unsigned char> *const ptr_I);
509 
510 #ifdef VISP_HAVE_PCL
511  virtual void postTracking(const vpImage<unsigned char> *const ptr_I = NULL,
512  const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud = nullptr);
513  virtual void preTracking(const vpImage<unsigned char> *const ptr_I = NULL,
514  const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud = nullptr);
515 #endif
516  virtual void postTracking(const vpImage<unsigned char> *const ptr_I = NULL, const unsigned int pointcloud_width = 0,
517  const unsigned int pointcloud_height = 0);
518  virtual void preTracking(const vpImage<unsigned char> *const ptr_I = NULL,
519  const std::vector<vpColVector> *const point_cloud = NULL,
520  const unsigned int pointcloud_width = 0, const unsigned int pointcloud_height = 0);
521  };
522 
523 protected:
530  std::map<std::string, vpHomogeneousMatrix> m_mapOfCameraTransformationMatrix;
532  std::map<vpTrackerType, double> m_mapOfFeatureFactors;
535  std::map<std::string, TrackerWrapper *> m_mapOfTrackers;
548 };
549 #endif
virtual void setDisplayFeatures(const bool displayF)
Definition: vpMbTracker.h:503
virtual void setOgreShowConfigDialog(const bool showConfigDialog)
Definition: vpMbTracker.h:629
virtual void loadConfigFile(const std::string &configFile)
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
virtual void track(const vpImage< unsigned char > &I)
virtual void track(const vpImage< unsigned char > &I)=0
virtual void computeVVSInteractionMatrixAndResidu()=0
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace=0, const std::string &name="")
virtual void computeVVSInit()=0
vpColVector m_w
Robust weights.
virtual unsigned int getClipping() const
Definition: vpMbTracker.h:256
virtual void setAngleDisappear(const double &a)
Definition: vpMbTracker.h:466
Implementation of an homogeneous matrix and operations on such kind of matrices.
virtual void track(const vpImage< unsigned char > &)
virtual void loadConfigFile(const std::string &configFile)
virtual void setOptimizationMethod(const vpMbtOptimizationMethod &opt)
Definition: vpMbTracker.h:543
virtual void loadModel(const std::string &modelFile, const bool verbose=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
vpHomogeneousMatrix cMo
The current pose.
Definition: vpMbTracker.h:119
virtual void setClipping(const unsigned int &flags)
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius, const int idFace=0, const std::string &name="")=0
virtual void track(const vpImage< unsigned char > &)
virtual void computeVVSInit()
Definition: vpMe.h:60
virtual void setMask(const vpImage< bool > &mask)
Definition: vpMbTracker.h:549
Make the complete tracking of an object by using its CAD model.
virtual void computeVVSInteractionMatrixAndResidu()
virtual void initFromPose(const vpImage< unsigned char > &I, const std::string &initFile)
Real-time 6D object pose tracking using its CAD model.
std::map< vpTrackerType, double > m_mapOfFeatureFactors
Ponderation between each feature type in the VVS stage.
virtual void resetTracker()=0
std::map< std::string, TrackerWrapper * > m_mapOfTrackers
virtual vpColVector getRobustWeights() const
Class that defines what is a point.
Definition: vpPoint.h:58
vpCameraParameters cam
The camera parameters.
Definition: vpMbTracker.h:117
virtual void init(const vpImage< unsigned char > &I)=0
vpMatrix m_L
Interaction matrix.
virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name="")
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
virtual void initFaceFromLines(vpMbtPolygon &polygon)
virtual void setGoodNbRayCastingAttemptsRatio(const double &ratio)
Definition: vpMbTracker.h:603
vpColVector m_weightedError
Weighted error.
Implementation of a polygon of the model used by the model-based tracker.
Definition: vpMbtPolygon.h:66
virtual void setCameraParameters(const vpCameraParameters &camera)
Definition: vpMbTracker.h:473
virtual void setProjectionErrorComputation(const bool &flag)
virtual vpHomogeneousMatrix getPose() const
Definition: vpMbTracker.h:423
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)
virtual void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo_, const bool verbose=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
virtual void getCameraParameters(vpCameraParameters &camera) const
Definition: vpMbTracker.h:248
virtual void initFaceFromCorners(vpMbtPolygon &polygon)=0
Generic class defining intrinsic camera parameters.
Main methods for a model-based tracker.
Definition: vpMbTracker.h:110
virtual void computeVVSInteractionMatrixAndResidu()
virtual void computeVVSWeights(vpRobust &robust, const vpColVector &error, vpColVector &w)
virtual void setAngleAppear(const double &a)
Definition: vpMbTracker.h:455
virtual void setProjectionErrorDisplay(const bool display)
Definition: vpMbTracker.h:575
Model based tracker using only KLT.
virtual void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
Definition: vpMbTracker.h:613
virtual void computeVVSWeights()
virtual void setMinLineLengthThresh(const double minLineLengthThresh, const std::string &name="")
std::map< std::string, vpHomogeneousMatrix > m_mapOfCameraTransformationMatrix
virtual void initFaceFromCorners(vpMbtPolygon &polygon)
virtual void setNearClippingDistance(const double &dist)
virtual void setCameraParameters(const vpCameraParameters &camera)
virtual void preTracking(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, std::map< std::string, pcl::PointCloud< pcl::PointXYZ >::ConstPtr > &mapOfPointClouds)
virtual void setScanLineVisibilityTest(const bool &v)
virtual void setOgreVisibilityTest(const bool &v)
virtual double computeCurrentProjectionError(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo, const vpCameraParameters &_cam)
vpColVector m_error
(s - s*)
virtual void init(const vpImage< unsigned char > &I)
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
virtual void setOgreVisibilityTest(const bool &v)
std::string m_referenceCameraName
Name of the reference camera.
virtual void initFaceFromLines(vpMbtPolygon &polygon)=0
virtual void setFarClippingDistance(const double &dist)
virtual void testTracking()=0
virtual void setProjectionErrorDisplayArrowLength(const unsigned int length)
Definition: vpMbTracker.h:580
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
Definition: vpKltOpencv.h:78
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)
virtual vpMbtPolygon * getPolygon(const unsigned int index)
Definition: vpMbTracker.h:395
virtual unsigned int getNbPolygon() const
Definition: vpMbTracker.h:368
virtual void initClick(const vpImage< unsigned char > &I, const std::string &initFile, const bool displayHelp=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
virtual void setTrackerType(const int type)
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
virtual void setScanLineVisibilityTest(const bool &v)
Definition: vpMbTracker.h:587
virtual void setClipping(const unsigned int &flags)
virtual vpColVector getError() const
virtual void setProjectionErrorDisplayArrowThickness(const unsigned int thickness)
Definition: vpMbTracker.h:585
virtual void initFromPoints(const vpImage< unsigned char > &I, const std::string &initFile)
virtual void computeVVS(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages)
virtual void setFarClippingDistance(const double &dist)
virtual vpMbHiddenFaces< vpMbtPolygon > & getFaces()
Definition: vpMbTracker.h:332
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius, const int idFace=0, const std::string &name="")
virtual int getTrackerType() const
virtual std::pair< std::vector< vpPolygon >, std::vector< std::vector< vpPoint > > > getPolygonFaces(const bool orderPolygons=true, const bool useVisibility=true, const bool clipPolygon=false)
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace=0, const std::string &name="")=0
virtual void setProjectionErrorComputation(const bool &flag)
Definition: vpMbTracker.h:570
virtual void setLod(const bool useLod, const std::string &name="")
virtual void setNearClippingDistance(const double &dist)