Visual Servoing Platform  version 3.1.0
vpMbGenericTracker.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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 
48 class VISP_EXPORT vpMbGenericTracker : public vpMbTracker
49 {
50 public:
52  EDGE_TRACKER = 1 << 0,
53 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
54  KLT_TRACKER = 1 << 1,
55 #endif
56  DEPTH_NORMAL_TRACKER = 1 << 2,
57  DEPTH_DENSE_TRACKER = 1 << 3
58  };
59 
61  vpMbGenericTracker(const unsigned int nbCameras, const int trackerType = EDGE_TRACKER);
62  explicit vpMbGenericTracker(const std::vector<int> &trackerTypes);
63  vpMbGenericTracker(const std::vector<std::string> &cameraNames, const std::vector<int> &trackerTypes);
64 
65  virtual ~vpMbGenericTracker();
66 
67  virtual void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
68  const vpColor &col, const unsigned int thickness = 1, const bool displayFullModel = false);
69  virtual void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
70  const vpColor &col, const unsigned int thickness = 1, const bool displayFullModel = false);
71 
72  virtual void display(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
73  const vpHomogeneousMatrix &c1Mo, const vpHomogeneousMatrix &c2Mo, const vpCameraParameters &cam1,
74  const vpCameraParameters &cam2, const vpColor &color, const unsigned int thickness = 1,
75  const bool displayFullModel = false);
76  virtual void display(const vpImage<vpRGBa> &I1, const vpImage<vpRGBa> &I2, const vpHomogeneousMatrix &c1Mo,
77  const vpHomogeneousMatrix &c2Mo, const vpCameraParameters &cam1, const vpCameraParameters &cam2,
78  const vpColor &color, const unsigned int thickness = 1, const bool displayFullModel = false);
79 
80  virtual void display(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
81  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
82  const std::map<std::string, vpCameraParameters> &mapOfCameraParameters, const vpColor &col,
83  const unsigned int thickness = 1, const bool displayFullModel = false);
84  virtual void display(const std::map<std::string, const vpImage<vpRGBa> *> &mapOfImages,
85  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
86  const std::map<std::string, vpCameraParameters> &mapOfCameraParameters, const vpColor &col,
87  const unsigned int thickness = 1, const bool displayFullModel = false);
88 
89  virtual std::vector<std::string> getCameraNames() const;
90 
92  virtual void getCameraParameters(vpCameraParameters &cam1, vpCameraParameters &cam2) const;
93  virtual void getCameraParameters(std::map<std::string, vpCameraParameters> &mapOfCameraParameters) const;
94 
95  virtual std::map<std::string, int> getCameraTrackerTypes() const;
96 
98  virtual void getClipping(unsigned int &clippingFlag1, unsigned int &clippingFlag2) const;
99  virtual void getClipping(std::map<std::string, unsigned int> &mapOfClippingFlags) const;
100 
101  virtual inline vpColVector getError() const { return m_error; }
102 
104  virtual vpMbHiddenFaces<vpMbtPolygon> &getFaces(const std::string &cameraName);
105 
106 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
107  virtual std::list<vpMbtDistanceCircle *> &getFeaturesCircle();
108  virtual std::list<vpMbtDistanceKltCylinder *> &getFeaturesKltCylinder();
109  virtual std::list<vpMbtDistanceKltPoints *> &getFeaturesKlt();
110 #endif
111 
112  virtual double getGoodMovingEdgesRatioThreshold() const;
113 
114 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
115  virtual std::vector<vpImagePoint> getKltImagePoints() const;
116  virtual std::map<int, vpImagePoint> getKltImagePointsWithId() const;
117 
118  virtual unsigned int getKltMaskBorder() const;
119  virtual int getKltNbPoints() const;
120 
121  virtual vpKltOpencv getKltOpencv() const;
122  virtual void getKltOpencv(vpKltOpencv &klt1, vpKltOpencv &klt2) const;
123  virtual void getKltOpencv(std::map<std::string, vpKltOpencv> &mapOfKlts) const;
124 
125 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
126  virtual std::vector<cv::Point2f> getKltPoints() const;
127 #endif
128 
129  virtual double getKltThresholdAcceptation() const;
130 #endif
131 
132  virtual void getLcircle(const std::string &cameraName, std::list<vpMbtDistanceCircle *> &circlesList,
133  const unsigned int level = 0) const;
134  virtual void getLcylinder(const std::string &cameraName, std::list<vpMbtDistanceCylinder *> &cylindersList,
135  const unsigned int level = 0) const;
136  virtual void getLline(const std::string &cameraName, std::list<vpMbtDistanceLine *> &linesList,
137  const unsigned int level = 0) const;
138 
139  virtual vpMe getMovingEdge() const;
140  virtual void getMovingEdge(vpMe &me1, vpMe &me2) const;
141  virtual void getMovingEdge(std::map<std::string, vpMe> &mapOfMovingEdges) const;
142 
143  virtual unsigned int getNbPoints(const unsigned int level = 0) const;
144  virtual void getNbPoints(std::map<std::string, unsigned int> &mapOfNbPoints, const unsigned int level = 0) const;
145 
146  virtual inline unsigned int getNbPolygon() const;
147  virtual void getNbPolygon(std::map<std::string, unsigned int> &mapOfNbPolygons) const;
148 
149  virtual vpMbtPolygon *getPolygon(const unsigned int index);
150  virtual vpMbtPolygon *getPolygon(const std::string &cameraName, const unsigned int index);
151 
152  virtual std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > >
153  getPolygonFaces(const bool orderPolygons = true, const bool useVisibility = true, const bool clipPolygon = false);
154  virtual void getPolygonFaces(std::map<std::string, std::vector<vpPolygon> > &mapOfPolygons,
155  std::map<std::string, std::vector<std::vector<vpPoint> > > &mapOfPoints,
156  const bool orderPolygons = true, const bool useVisibility = true,
157  const bool clipPolygon = false);
158 
159  using vpMbTracker::getPose;
160  virtual void getPose(vpHomogeneousMatrix &c1Mo, vpHomogeneousMatrix &c2Mo) const;
161  virtual void getPose(std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses) const;
162 
163  virtual inline vpColVector getRobustWeights() const { return m_w; }
164 
165  virtual void init(const vpImage<unsigned char> &I);
166 
167 #ifdef VISP_HAVE_MODULE_GUI
169  virtual void initClick(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
170  const std::string &initFile1, const std::string &initFile2, const bool displayHelp = false);
171  virtual void initClick(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
172  const std::map<std::string, std::string> &mapOfInitFiles, const bool displayHelp = false);
173 #endif
174 
176  virtual void initFromPoints(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
177  const std::string &initFile1, const std::string &initFile2);
178  virtual void initFromPoints(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
179  const std::map<std::string, std::string> &mapOfInitPoints);
180 
182  virtual void initFromPose(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
183  const std::string &initFile1, const std::string &initFile2);
184  virtual void initFromPose(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
185  const std::map<std::string, std::string> &mapOfInitPoses);
186 
187  virtual void initFromPose(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
188  const vpHomogeneousMatrix &c1Mo, const vpHomogeneousMatrix &c2Mo);
189  virtual void initFromPose(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
190  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses);
191 
192  virtual void loadConfigFile(const std::string &configFile);
193  virtual void loadConfigFile(const std::string &configFile1, const std::string &configFile2);
194  virtual void loadConfigFile(const std::map<std::string, std::string> &mapOfConfigFiles);
195 
197  virtual void loadModel(const std::string &modelFile, const bool verbose = false);
198  virtual void loadModel(const std::string &modelFile1, const std::string &modelFile2, const bool verbose = false);
199  virtual void loadModel(const std::map<std::string, std::string> &mapOfModelFiles, const bool verbose = false);
200 
201  virtual void reInitModel(const vpImage<unsigned char> &I, const std::string &cad_name,
202  const vpHomogeneousMatrix &cMo_, const bool verbose = false);
203  virtual void reInitModel(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
204  const std::string &cad_name1, const std::string &cad_name2, const vpHomogeneousMatrix &c1Mo,
205  const vpHomogeneousMatrix &c2Mo, const bool verbose = false);
206  virtual void reInitModel(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
207  const std::map<std::string, std::string> &mapOfModelFiles,
208  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
209  const bool verbose = false);
210 
211  virtual void resetTracker();
212 
213  virtual void setAngleAppear(const double &a);
214  virtual void setAngleAppear(const double &a1, const double &a2);
215  virtual void setAngleAppear(const std::map<std::string, double> &mapOfAngles);
216 
217  virtual void setAngleDisappear(const double &a);
218  virtual void setAngleDisappear(const double &a1, const double &a2);
219  virtual void setAngleDisappear(const std::map<std::string, double> &mapOfAngles);
220 
221  virtual void setCameraParameters(const vpCameraParameters &camera);
222  virtual void setCameraParameters(const vpCameraParameters &camera1, const vpCameraParameters &camera2);
223  virtual void setCameraParameters(const std::map<std::string, vpCameraParameters> &mapOfCameraParameters);
224 
225  virtual void setCameraTransformationMatrix(const std::string &cameraName,
226  const vpHomogeneousMatrix &cameraTransformationMatrix);
227  virtual void
228  setCameraTransformationMatrix(const std::map<std::string, vpHomogeneousMatrix> &mapOfTransformationMatrix);
229 
230  virtual void setClipping(const unsigned int &flags);
231  virtual void setClipping(const unsigned int &flags1, const unsigned int &flags2);
232  virtual void setClipping(const std::map<std::string, unsigned int> &mapOfClippingFlags);
233 
234  virtual void setDepthDenseFilteringMaxDistance(const double maxDistance);
235  virtual void setDepthDenseFilteringMethod(const int method);
236  virtual void setDepthDenseFilteringMinDistance(const double minDistance);
237  virtual void setDepthDenseFilteringOccupancyRatio(const double occupancyRatio);
238  virtual void setDepthDenseSamplingStep(const unsigned int stepX, const unsigned int stepY);
239 
240  virtual void setDepthNormalFaceCentroidMethod(const vpMbtFaceDepthNormal::vpFaceCentroidType &method);
241  virtual void setDepthNormalFeatureEstimationMethod(const vpMbtFaceDepthNormal::vpFeatureEstimationType &method);
242  virtual void setDepthNormalPclPlaneEstimationMethod(const int method);
243  virtual void setDepthNormalPclPlaneEstimationRansacMaxIter(const int maxIter);
244  virtual void setDepthNormalPclPlaneEstimationRansacThreshold(const double thresold);
245  virtual void setDepthNormalSamplingStep(const unsigned int stepX, const unsigned int stepY);
246 
247  virtual void setDisplayFeatures(const bool displayF);
248 
249  virtual void setFarClippingDistance(const double &dist);
250  virtual void setFarClippingDistance(const double &dist1, const double &dist2);
251  virtual void setFarClippingDistance(const std::map<std::string, double> &mapOfClippingDists);
252 
253  virtual void setFeatureFactors(const std::map<vpTrackerType, double> &mapOfFeatureFactors);
254 
255  virtual void setGoodMovingEdgesRatioThreshold(const double threshold);
256 
257 #ifdef VISP_HAVE_OGRE
258  virtual void setGoodNbRayCastingAttemptsRatio(const double &ratio);
259  virtual void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts);
260 #endif
261 
262 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
263  virtual void setKltMaskBorder(const unsigned int &e);
264  virtual void setKltMaskBorder(const unsigned int &e1, const unsigned int &e2);
265  virtual void setKltMaskBorder(const std::map<std::string, unsigned int> &mapOfErosions);
266 
267  virtual void setKltOpencv(const vpKltOpencv &t);
268  virtual void setKltOpencv(const vpKltOpencv &t1, const vpKltOpencv &t2);
269  virtual void setKltOpencv(const std::map<std::string, vpKltOpencv> &mapOfKlts);
270 
271  virtual void setKltThresholdAcceptation(const double th);
272 
273 #endif
274 
275  virtual void setLod(const bool useLod, const std::string &name = "");
276 
277  virtual void setMinLineLengthThresh(const double minLineLengthThresh, const std::string &name = "");
278  virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name = "");
279 
280  virtual void setMovingEdge(const vpMe &me);
281  virtual void setMovingEdge(const vpMe &me1, const vpMe &me2);
282  virtual void setMovingEdge(const std::map<std::string, vpMe> &mapOfMe);
283 
284  virtual void setNearClippingDistance(const double &dist);
285  virtual void setNearClippingDistance(const double &dist1, const double &dist2);
286  virtual void setNearClippingDistance(const std::map<std::string, double> &mapOfDists);
287 
288  virtual void setOgreShowConfigDialog(const bool showConfigDialog);
289  virtual void setOgreVisibilityTest(const bool &v);
290 
291  virtual void setOptimizationMethod(const vpMbtOptimizationMethod &opt);
292 
293  virtual void setPose(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cdMo);
294  virtual void setPose(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2,
295  const vpHomogeneousMatrix &c1Mo, const vpHomogeneousMatrix &c2Mo);
296  virtual void setPose(const std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
297  const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses);
298 
299  virtual void setProjectionErrorComputation(const bool &flag);
300 
301  virtual void setReferenceCameraName(const std::string &referenceCameraName);
302 
303  virtual void setScanLineVisibilityTest(const bool &v);
304 
305  virtual void setTrackerType(const int type);
306  virtual void setTrackerType(const std::map<std::string, int> &mapOfTrackerTypes);
307 
308  virtual void setUseEdgeTracking(const std::string &name, const bool &useEdgeTracking);
309 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
310  virtual void setUseKltTracking(const std::string &name, const bool &useKltTracking);
311 #endif
312 
313  virtual void testTracking();
314 
315  virtual void track(const vpImage<unsigned char> &I);
316  virtual void track(const vpImage<unsigned char> &I1, const vpImage<unsigned char> &I2);
317  virtual void track(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages);
318 #ifdef VISP_HAVE_PCL
319  virtual void track(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
320  std::map<std::string, pcl::PointCloud<pcl::PointXYZ>::ConstPtr> &mapOfPointClouds);
321 #endif
322  virtual void track(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
323  std::map<std::string, const std::vector<vpColVector> *> &mapOfPointClouds,
324  std::map<std::string, unsigned int> &mapOfPointCloudWidths,
325  std::map<std::string, unsigned int> &mapOfPointCloudHeights);
326 
327 protected:
328  virtual void computeProjectionError();
329 
330  virtual void computeVVS(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages);
331 
332  virtual void computeVVSInit();
333  virtual void computeVVSInit(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages);
335  virtual void computeVVSInteractionMatrixAndResidu(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
336  std::map<std::string, vpVelocityTwistMatrix> &mapOfVelocityTwist);
338  virtual void computeVVSWeights();
339 
340  virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius,
341  const int idFace = 0, const std::string &name = "");
342 
343  virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace = 0,
344  const std::string &name = "");
345 
346  virtual void initFaceFromCorners(vpMbtPolygon &polygon);
347 
348  virtual void initFaceFromLines(vpMbtPolygon &polygon);
349 
350 #ifdef VISP_HAVE_PCL
351  virtual void preTracking(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
352  std::map<std::string, pcl::PointCloud<pcl::PointXYZ>::ConstPtr> &mapOfPointClouds);
353 #endif
354  virtual void preTracking(std::map<std::string, const vpImage<unsigned char> *> &mapOfImages,
355  std::map<std::string, const std::vector<vpColVector> *> &mapOfPointClouds,
356  std::map<std::string, unsigned int> &mapOfPointCloudWidths,
357  std::map<std::string, unsigned int> &mapOfPointCloudHeights);
358 
359 private:
360  class TrackerWrapper : public vpMbEdgeTracker,
361 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
362  public vpMbKltTracker,
363 #endif
364  public vpMbDepthNormalTracker,
365  public vpMbDepthDenseTracker
366  {
367  friend class vpMbGenericTracker;
368 
369  public:
373  vpMatrix m_L;
375  int m_trackerType;
380 
381  TrackerWrapper();
382  explicit TrackerWrapper(const int trackerType);
383 
384  virtual ~TrackerWrapper();
385 
386  virtual inline vpColVector getError() const { return m_error; }
387 
388  virtual inline vpColVector getRobustWeights() const { return m_w; }
389 
390  virtual inline int getTrackerType() const { return m_trackerType; }
391 
392  virtual void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
393  const vpColor &col, const unsigned int thickness = 1, const bool displayFullModel = false);
394  virtual void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
395  const vpColor &col, const unsigned int thickness = 1, const bool displayFullModel = false);
396 
397  virtual void init(const vpImage<unsigned char> &I);
398 
399  virtual void loadConfigFile(const std::string &configFile);
400 
401  virtual void reInitModel(const vpImage<unsigned char> &I, const std::string &cad_name,
402  const vpHomogeneousMatrix &cMo_, const bool verbose = false);
403 
404  virtual void resetTracker();
405 
406  virtual void setCameraParameters(const vpCameraParameters &camera);
407 
408  virtual void setClipping(const unsigned int &flags);
409 
410  virtual void setFarClippingDistance(const double &dist);
411 
412  virtual void setNearClippingDistance(const double &dist);
413 
414  virtual void setOgreVisibilityTest(const bool &v);
415 
416  virtual void setPose(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cdMo);
417 
418  virtual void setProjectionErrorComputation(const bool &flag);
419 
420  virtual void setScanLineVisibilityTest(const bool &v);
421 
422  virtual void setTrackerType(const int type);
423 
424  virtual void testTracking();
425 
426  virtual void track(const vpImage<unsigned char> &I);
427 #ifdef VISP_HAVE_PCL
430  virtual void track(const vpImage<unsigned char> *const ptr_I = NULL,
431  const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud = nullptr);
432 #endif
433 
434  protected:
435  virtual void computeVVS(const vpImage<unsigned char> *const ptr_I);
436  virtual void computeVVSInit();
437  virtual void computeVVSInit(const vpImage<unsigned char> *const ptr_I);
440  virtual void computeVVSInteractionMatrixAndResidu(const vpImage<unsigned char> *const ptr_I);
442  virtual void computeVVSWeights();
443 
444  virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius,
445  const int idFace = 0, const std::string &name = "");
446 
447  virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace = 0,
448  const std::string &name = "");
449 
450  virtual void initFaceFromCorners(vpMbtPolygon &polygon);
451  virtual void initFaceFromLines(vpMbtPolygon &polygon);
452 
453  virtual void initMbtTracking(const vpImage<unsigned char> *const ptr_I);
454 
455 #ifdef VISP_HAVE_PCL
456  virtual void postTracking(const vpImage<unsigned char> *const ptr_I = NULL,
457  const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud = nullptr);
458  virtual void preTracking(const vpImage<unsigned char> *const ptr_I = NULL,
459  const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud = nullptr);
460 #endif
461  virtual void postTracking(const vpImage<unsigned char> *const ptr_I = NULL, const unsigned int pointcloud_width = 0,
462  const unsigned int pointcloud_height = 0);
463  virtual void preTracking(const vpImage<unsigned char> *const ptr_I = NULL,
464  const std::vector<vpColVector> *const point_cloud = NULL,
465  const unsigned int pointcloud_width = 0, const unsigned int pointcloud_height = 0);
466  };
467 
468 protected:
475  std::map<std::string, vpHomogeneousMatrix> m_mapOfCameraTransformationMatrix;
477  std::map<vpTrackerType, double> m_mapOfFeatureFactors;
480  std::map<std::string, TrackerWrapper *> m_mapOfTrackers;
493 };
494 #endif
virtual unsigned int getClipping() const
Definition: vpMbTracker.h:223
virtual void setDisplayFeatures(const bool displayF)
Definition: vpMbTracker.h:470
virtual void setOgreShowConfigDialog(const bool showConfigDialog)
Definition: vpMbTracker.h:575
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 void setAngleDisappear(const double &a)
Definition: vpMbTracker.h:433
Implementation of an homogeneous matrix and operations on such kind of matrices.
virtual void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo_, const bool verbose=false)
virtual void track(const vpImage< unsigned char > &)
virtual void setOptimizationMethod(const vpMbtOptimizationMethod &opt)
Definition: vpMbTracker.h:510
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
vpHomogeneousMatrix cMo
The current pose.
Definition: vpMbTracker.h:115
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
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)
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 void computeVVS(std::map< std::string, const vpImage< unsigned char > *> &mapOfImages)
Class that defines what is a point.
Definition: vpPoint.h:58
vpCameraParameters cam
The camera parameters.
Definition: vpMbTracker.h:113
virtual void init(const vpImage< unsigned char > &I)=0
vpMatrix m_L
Interaction matrix.
virtual vpHomogeneousMatrix getPose() const
Definition: vpMbTracker.h:390
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:549
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:440
virtual void setProjectionErrorComputation(const bool &flag)
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 initFaceFromCorners(vpMbtPolygon &polygon)=0
Generic class defining intrinsic camera parameters.
Main methods for a model-based tracker.
Definition: vpMbTracker.h:106
virtual void computeVVSInteractionMatrixAndResidu()
virtual void computeVVSWeights(vpRobust &robust, const vpColVector &error, vpColVector &w)
virtual void setAngleAppear(const double &a)
Definition: vpMbTracker.h:422
Model based tracker using only KLT.
virtual void loadConfigFile(const std::string &configFile)=0
virtual void initClick(const vpImage< unsigned char > &I, const std::string &initFile, const bool displayHelp=false)
virtual void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
Definition: vpMbTracker.h:559
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 vpColVector getError() const
virtual void setCameraParameters(const vpCameraParameters &camera)
virtual void setScanLineVisibilityTest(const bool &v)
virtual vpColVector getRobustWeights() const
virtual void setOgreVisibilityTest(const bool &v)
virtual void loadModel(const char *modelFile, const bool verbose=false)
virtual void getCameraParameters(vpCameraParameters &camera) const
Definition: vpMbTracker.h:215
virtual unsigned int getNbPolygon() const
Definition: vpMbTracker.h:335
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 preTracking(std::map< std::string, const vpImage< unsigned char > *> &mapOfImages, std::map< std::string, pcl::PointCloud< pcl::PointXYZ >::ConstPtr > &mapOfPointClouds)
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:362
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:533
virtual void setClipping(const unsigned int &flags)
virtual void initFromPoints(const vpImage< unsigned char > &I, const std::string &initFile)
virtual void setFarClippingDistance(const double &dist)
virtual vpMbHiddenFaces< vpMbtPolygon > & getFaces()
Definition: vpMbTracker.h:299
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius, const int idFace=0, const std::string &name="")
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:531
virtual void setLod(const bool useLod, const std::string &name="")
virtual void setNearClippingDistance(const double &dist)