Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
vpMbTracker.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2023 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 https://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. This class declares the methods to implement
33  *in order to have a model based tracker.
34  *
35  * Authors:
36  * Romain Tallonneau
37  * Aurelien Yol
38  *
39 *****************************************************************************/
40 
45 #ifndef vpMbTracker_hh
46 #define vpMbTracker_hh
47 
48 #include <map>
49 #include <string>
50 #include <vector>
51 
52 #include <visp3/core/vpConfig.h>
53 #include <visp3/core/vpCameraParameters.h>
54 #include <visp3/core/vpColVector.h>
55 #include <visp3/core/vpHomogeneousMatrix.h>
56 #include <visp3/core/vpImage.h>
57 #include <visp3/core/vpImagePoint.h>
58 #include <visp3/core/vpMatrix.h>
59 #include <visp3/core/vpPoint.h>
60 #include <visp3/core/vpPolygon.h>
61 #include <visp3/core/vpRGBa.h>
62 #include <visp3/core/vpRobust.h>
63 #include <visp3/mbt/vpMbHiddenFaces.h>
64 #include <visp3/mbt/vpMbtPolygon.h>
65 
66 #include <visp3/mbt/vpMbtDistanceCircle.h>
67 #include <visp3/mbt/vpMbtDistanceCylinder.h>
68 #include <visp3/mbt/vpMbtDistanceLine.h>
69 
70 #ifdef VISP_HAVE_COIN3D
71 // Work around to avoid type redefinition int8_t with Coin
72 // #if defined(_WIN32) && defined(VISP_HAVE_OGRE) && (_MSC_VER >= 1600) //
73 // Visual Studio 2010
74 // #define HAVE_INT8_T 1
75 // #endif
76 
77 // Inventor includes
78 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
79 #include <Inventor/VRMLnodes/SoVRMLIndexedFaceSet.h>
80 #include <Inventor/VRMLnodes/SoVRMLIndexedLineSet.h>
81 #endif
82 
83 BEGIN_VISP_NAMESPACE
106 class VISP_EXPORT vpMbTracker
107 {
108 public:
109  typedef enum { GAUSS_NEWTON_OPT = 0, LEVENBERG_MARQUARDT_OPT = 1 } vpMbtOptimizationMethod;
110 
111 protected:
122  std::string modelFileName;
128  std::string poseSavingFilename;
143 
147  double angleAppears;
151  double distNearClip;
153  double distFarClip;
155  unsigned int clippingFlag;
157  bool useOgre;
162  unsigned int nbPoints;
164  unsigned int nbLines;
166  unsigned int nbPolygonLines;
168  unsigned int nbPolygonPoints;
170  unsigned int nbCylinders;
172  unsigned int nbCircles;
184  std::map<std::string, std::string> mapOfParameterNames;
189  double m_lambda;
191  unsigned int m_maxIter;
195  double m_initialMu;
196 
198  std::vector<vpMbtDistanceLine *> m_projectionErrorLines;
200  std::vector<vpMbtDistanceCylinder *> m_projectionErrorCylinders;
202  std::vector<vpMbtDistanceCircle *> m_projectionErrorCircles;
230 
231 public:
232  vpMbTracker();
233  virtual ~vpMbTracker();
234 
236  virtual double computeCurrentProjectionError(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &_cMo,
237  const vpCameraParameters &_cam);
238 
240  virtual inline double getAngleAppear() const { return angleAppears; }
241 
243  virtual inline double getAngleDisappear() const { return angleDisappears; }
244 
250  virtual void getCameraParameters(vpCameraParameters &cam) const { cam = m_cam; }
251 
258  virtual inline unsigned int getClipping() const { return clippingFlag; }
259 
268  {
269  if (!computeCovariance) {
270  // vpTRACE("Warning : The covariance matrix has not been computed.
271  // See setCovarianceComputation() to do it.");
272  std::cerr << "Warning : The covariance matrix has not been computed. "
273  "See setCovarianceComputation() to do it."
274  << std::endl;
275  }
276 
277  return covarianceMatrix;
278  }
279 
286  virtual inline double getInitialMu() const { return m_initialMu; }
287 
293  virtual inline double getLambda() const { return m_lambda; }
294 
300  virtual inline unsigned int getMaxIter() const { return m_maxIter; }
301 
312  virtual double getProjectionError() const { return projectionError; }
313 
314  virtual vpColVector getEstimatedDoF() const;
315 
331  virtual vpColVector getError() const = 0;
332 
334  virtual inline vpMbHiddenFaces<vpMbtPolygon> &getFaces() { return faces; }
335 
341  virtual inline double getFarClippingDistance() const { return distFarClip; }
342 
363  virtual vpColVector getRobustWeights() const = 0;
364 
370  virtual inline unsigned int getNbPolygon() const { return static_cast<unsigned int>(faces.size()); }
371 
377  virtual inline double getNearClippingDistance() const { return distNearClip; }
378 
386  virtual inline vpMbtOptimizationMethod getOptimizationMethod() const { return m_optimizationMethod; }
387 
397  virtual inline vpMbtPolygon *getPolygon(unsigned int index)
398  {
399  if (index >= static_cast<unsigned int>(faces.size())) {
400  throw vpException(vpException::dimensionError, "index out of range");
401  }
402 
403  return faces[index];
404  }
405 
406  virtual std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > >
407  getPolygonFaces(bool orderPolygons = true, bool useVisibility = true, bool clipPolygon = false);
408 
416  virtual inline void getPose(vpHomogeneousMatrix &cMo) const { cMo = m_cMo; }
417 
425  virtual inline vpHomogeneousMatrix getPose() const { return m_cMo; }
426 
427  virtual inline double getStopCriteriaEpsilon() const { return m_stopCriteriaEpsilon; }
428 
429  // initializer
430 
431 #ifdef VISP_HAVE_MODULE_GUI
432  virtual void initClick(const vpImage<unsigned char> &I, const std::string &initFile, bool displayHelp = false,
434  virtual void initClick(const vpImage<vpRGBa> &I_color, const std::string &initFile, bool displayHelp = false,
436 
437  virtual void initClick(const vpImage<unsigned char> &I, const std::vector<vpPoint> &points3D_list,
438  const std::string &displayFile = "");
439  virtual void initClick(const vpImage<vpRGBa> &I_color, const std::vector<vpPoint> &points3D_list,
440  const std::string &displayFile = "");
441 #endif
442 
443  virtual void initFromPoints(const vpImage<unsigned char> &I, const std::string &initFile);
444  virtual void initFromPoints(const vpImage<vpRGBa> &I_color, const std::string &initFile);
445 
446  virtual void initFromPoints(const vpImage<unsigned char> &I, const std::vector<vpImagePoint> &points2D_list,
447  const std::vector<vpPoint> &points3D_list);
448  virtual void initFromPoints(const vpImage<vpRGBa> &I_color, const std::vector<vpImagePoint> &points2D_list,
449  const std::vector<vpPoint> &points3D_list);
450 
451  virtual void initFromPose(const vpImage<unsigned char> &I, const std::string &initFile);
452  virtual void initFromPose(const vpImage<vpRGBa> &I_color, const std::string &initFile);
453 
454  virtual void initFromPose(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
455  virtual void initFromPose(const vpImage<vpRGBa> &I_color, const vpHomogeneousMatrix &cMo);
456 
457  virtual void initFromPose(const vpImage<unsigned char> &I, const vpPoseVector &cPo);
458  virtual void initFromPose(const vpImage<vpRGBa> &I_color, const vpPoseVector &cPo);
459 
460  virtual void loadModel(const std::string &modelFile, bool verbose = false,
462 
472  virtual inline void setAngleAppear(const double &a) { angleAppears = a; }
473 
483  virtual inline void setAngleDisappear(const double &a) { angleDisappears = a; }
484 
490  virtual void setCameraParameters(const vpCameraParameters &cam) { m_cam = cam; }
491 
492  virtual void setClipping(const unsigned int &flags);
493 
502  virtual void setCovarianceComputation(const bool &flag) { computeCovariance = flag; }
503 
520  virtual void setDisplayFeatures(bool displayF) { displayFeatures = displayF; }
521 
522  virtual void setEstimatedDoF(const vpColVector &v);
523 
524  virtual void setFarClippingDistance(const double &dist);
525 
531  virtual inline void setInitialMu(double mu) { m_initialMu = mu; }
532 
538  virtual inline void setLambda(double gain) { m_lambda = gain; }
539 
540  virtual void setLod(bool useLod, const std::string &name = "");
541 
547  virtual inline void setMaxIter(unsigned int max) { m_maxIter = max; }
548 
549  virtual void setMinLineLengthThresh(double minLineLengthThresh, const std::string &name = "");
550 
551  virtual void setMinPolygonAreaThresh(double minPolygonAreaThresh, const std::string &name = "");
552 
553  virtual void setNearClippingDistance(const double &dist);
554 
560  virtual inline void setOptimizationMethod(const vpMbtOptimizationMethod &opt) { m_optimizationMethod = opt; }
561 
562  void setProjectionErrorMovingEdge(const vpMe &me);
563 
564  void setProjectionErrorKernelSize(const unsigned int &size);
565 
566  virtual void setMask(const vpImage<bool> &mask) { m_mask = &mask; }
567 
574  virtual inline void setStopCriteriaEpsilon(const double eps) { m_stopCriteriaEpsilon = eps; }
575 
587  virtual void setProjectionErrorComputation(const bool &flag) { computeProjError = flag; }
588 
592  virtual void setProjectionErrorDisplay(bool display) { m_projectionErrorDisplay = display; }
593 
597  virtual void setProjectionErrorDisplayArrowLength(unsigned int length)
598  {
599  m_projectionErrorDisplayLength = length;
600  }
601 
605  virtual void setProjectionErrorDisplayArrowThickness(unsigned int thickness)
606  {
607  m_projectionErrorDisplayThickness = thickness;
608  }
609 
610  virtual void setScanLineVisibilityTest(const bool &v) { useScanLine = v; }
611 
612  virtual void setOgreVisibilityTest(const bool &v);
613 
614  void savePose(const std::string &filename) const;
615 
616 #ifdef VISP_HAVE_OGRE
626  virtual void setGoodNbRayCastingAttemptsRatio(const double &ratio) { faces.setGoodNbRayCastingAttemptsRatio(ratio); }
636  virtual void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
637  {
638  faces.setNbRayCastingAttemptsForVisibility(attempts);
639  }
640 #endif
641 
652  inline virtual void setOgreShowConfigDialog(bool showConfigDialog) { ogreShowConfigDialog = showConfigDialog; }
653 
664  inline void setPoseSavingFilename(const std::string &filename) { poseSavingFilename = filename; }
665 
666  /* PURE VIRTUAL METHODS */
667 
680  virtual void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
681  const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false) = 0;
694  virtual void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
695  const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false) = 0;
696 
697  virtual std::vector<std::vector<double> > getModelForDisplay(unsigned int width, unsigned int height,
698  const vpHomogeneousMatrix &cMo,
699  const vpCameraParameters &cam,
700  bool displayFullModel = false) = 0;
701 
707  virtual void init(const vpImage<unsigned char> &I) = 0;
708 
717  virtual void loadConfigFile(const std::string &configFile, bool verbose = true);
718 
722  virtual void resetTracker() = 0;
723 
734  virtual void setPose(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cdMo) = 0;
735 
746  virtual void setPose(const vpImage<vpRGBa> &I_color, const vpHomogeneousMatrix &cdMo) = 0;
747 
753  virtual void testTracking() = 0;
754 
760  virtual void track(const vpImage<unsigned char> &I) = 0;
761 
767  virtual void track(const vpImage<vpRGBa> &I) = 0;
768 
769 protected:
771  void addPolygon(const std::vector<vpPoint> &corners, int idFace = -1, const std::string &polygonName = "",
772  bool useLod = false, double minPolygonAreaThreshold = 2500.0, double minLineLengthThreshold = 50.0);
773  void addPolygon(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace = -1,
774  const std::string &polygonName = "", bool useLod = false, double minPolygonAreaThreshold = 2500.0);
775  void addPolygon(const vpPoint &p1, const vpPoint &p2, int idFace = -1, const std::string &polygonName = "",
776  bool useLod = false, double minLineLengthThreshold = 50);
777  void addPolygon(const std::vector<std::vector<vpPoint> > &listFaces, int idFace = -1,
778  const std::string &polygonName = "", bool useLod = false, double minLineLengthThreshold = 50);
779 
780  void addProjectionErrorCircle(const vpPoint &P1, const vpPoint &P2, const vpPoint &P3, double r, int idFace = -1,
781  const std::string &name = "");
782  void addProjectionErrorCylinder(const vpPoint &P1, const vpPoint &P2, double r, int idFace = -1,
783  const std::string &name = "");
784  void addProjectionErrorLine(vpPoint &p1, vpPoint &p2, int polygon = -1, std::string name = "");
785 
786  void addProjectionErrorPolygon(const std::vector<vpPoint> &corners, int idFace = -1,
787  const std::string &polygonName = "", bool useLod = false,
788  double minPolygonAreaThreshold = 2500.0, const double minLineLengthThreshold = 50.0);
789  void addProjectionErrorPolygon(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius,
790  int idFace = -1, const std::string &polygonName = "", bool useLod = false,
791  double minPolygonAreaThreshold = 2500.0);
792  void addProjectionErrorPolygon(const vpPoint &p1, const vpPoint &p2, int idFace = -1,
793  const std::string &polygonName = "", bool useLod = false,
794  double minLineLengthThreshold = 50);
795  void addProjectionErrorPolygon(const std::vector<std::vector<vpPoint> > &listFaces, int idFace = -1,
796  const std::string &polygonName = "", bool useLod = false,
797  double minLineLengthThreshold = 50);
798 
799  void createCylinderBBox(const vpPoint &p1, const vpPoint &p2, const double &radius,
800  std::vector<std::vector<vpPoint> > &listFaces);
801 
802  virtual void computeCovarianceMatrixVVS(const bool isoJoIdentity, const vpColVector &w_true,
803  const vpHomogeneousMatrix &cMoPrev, const vpMatrix &L_true,
804  const vpMatrix &LVJ_true, const vpColVector &error);
805 
806  void computeJTR(const vpMatrix &J, const vpColVector &R, vpColVector &JTR) const;
807 
808  double computeProjectionErrorImpl(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &_cMo,
809  const vpCameraParameters &_cam, unsigned int &nbFeatures);
810 
811  virtual void computeVVSCheckLevenbergMarquardt(unsigned int iter, vpColVector &error, const vpColVector &m_error_prev,
812  const vpHomogeneousMatrix &cMoPrev, double &mu,
813  bool &reStartFromLastIncrement, vpColVector *const w = nullptr,
814  const vpColVector *const m_w_prev = nullptr);
815  virtual void computeVVSInit() = 0;
817  virtual void computeVVSPoseEstimation(const bool isoJoIdentity, unsigned int iter, vpMatrix &L, vpMatrix &LTL,
818  vpColVector &R, const vpColVector &error, vpColVector &error_prev,
819  vpColVector &LTR, double &mu, vpColVector &v, const vpColVector *const w = nullptr,
820  vpColVector *const m_w_prev = nullptr);
821  virtual void computeVVSWeights(vpRobust &robust, const vpColVector &error, vpColVector &w);
822 
823 #ifdef VISP_HAVE_COIN3D
824  virtual void extractGroup(SoVRMLGroup *sceneGraphVRML2, vpHomogeneousMatrix &transform, int &idFace);
825  virtual void extractFaces(SoVRMLIndexedFaceSet *face_set, vpHomogeneousMatrix &transform, int &idFace,
826  const std::string &polygonName = "");
827  virtual void extractLines(SoVRMLIndexedLineSet *line_set, int &idFace, const std::string &polygonName = "");
828  virtual void extractCylinders(SoVRMLIndexedFaceSet *face_set, vpHomogeneousMatrix &transform, int &idFace,
829  const std::string &polygonName = "");
830 #endif
831 
832  vpPoint getGravityCenter(const std::vector<vpPoint> &_pts) const;
833 
847  virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace = 0,
848  const std::string &name = "") = 0;
849 
850 #ifdef VISP_HAVE_MODULE_GUI
851  virtual void initClick(const vpImage<unsigned char> *const I, const vpImage<vpRGBa> *const I_color,
852  const std::string &initFile, bool displayHelp = false,
854 
855  virtual void initClick(const vpImage<unsigned char> *const I, const vpImage<vpRGBa> *const I_color,
856  const std::vector<vpPoint> &points3D_list, const std::string &displayFile = "");
857 #endif
858 
859  virtual void initFromPoints(const vpImage<unsigned char> *const I, const vpImage<vpRGBa> *const I_color,
860  const std::string &initFile);
861 
862  virtual void initFromPoints(const vpImage<unsigned char> *const I, const vpImage<vpRGBa> *const I_color,
863  const std::vector<vpImagePoint> &points2D_list,
864  const std::vector<vpPoint> &points3D_list);
865 
866  virtual void initFromPose(const vpImage<unsigned char> *const I, const vpImage<vpRGBa> *const I_color,
867  const std::string &initFile);
868 
879  virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, double radius, int idFace = 0,
880  const std::string &name = "") = 0;
881 
894  virtual void initFaceFromCorners(vpMbtPolygon &polygon) = 0;
895  virtual void initFaceFromLines(vpMbtPolygon &polygon) = 0;
896 
897  void initProjectionErrorCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace = 0,
898  const std::string &name = "");
899  void initProjectionErrorCylinder(const vpPoint &p1, const vpPoint &p2, double radius, int idFace = 0,
900  const std::string &name = "");
901  void initProjectionErrorFaceFromCorners(vpMbtPolygon &polygon);
902  void initProjectionErrorFaceFromLines(vpMbtPolygon &polygon);
903 
904  virtual void loadVRMLModel(const std::string &modelFile);
905  virtual void loadCAOModel(const std::string &modelFile, std::vector<std::string> &vectorOfModelFilename,
906  int &startIdFace, bool verbose = false, bool parent = true,
908 
909  void projectionErrorInitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &_cMo);
910  void projectionErrorResetMovingEdges();
911  void projectionErrorVisibleFace(unsigned int width, unsigned int height, const vpHomogeneousMatrix &_cMo);
912 
913  void removeComment(std::ifstream &fileId);
914 
915  std::map<std::string, std::string> parseParameters(std::string &endLine);
916 
917  bool samePoint(const vpPoint &P1, const vpPoint &P2) const;
918 };
919 END_VISP_NAMESPACE
920 #endif
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Definition: vpColVector.h:191
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:157
error that can be emitted by ViSP classes.
Definition: vpException.h:60
@ dimensionError
Bad dimension.
Definition: vpException.h:71
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:169
void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
void setGoodNbRayCastingAttemptsRatio(const double &ratio)
unsigned int size() const
Main methods for a model-based tracker.
Definition: vpMbTracker.h:107
virtual double getNearClippingDistance() const
Definition: vpMbTracker.h:377
virtual void setProjectionErrorDisplayArrowLength(unsigned int length)
Definition: vpMbTracker.h:597
double m_lambda
Gain of the virtual visual servoing stage.
Definition: vpMbTracker.h:189
virtual void setMaxIter(unsigned int max)
Definition: vpMbTracker.h:547
virtual void display(const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)=0
vpCameraParameters m_projectionErrorCam
Camera parameters used for projection error computation.
Definition: vpMbTracker.h:221
unsigned int nbPolygonPoints
Number of polygon points in CAO model.
Definition: vpMbTracker.h:168
bool modelInitialised
Definition: vpMbTracker.h:125
virtual void setPose(const vpImage< vpRGBa > &I_color, const vpHomogeneousMatrix &cdMo)=0
double minLineLengthThresholdGeneral
Minimum line length threshold for LOD mode (general setting)
Definition: vpMbTracker.h:179
bool m_projectionErrorDisplay
Display gradient and model orientation for projection error computation.
Definition: vpMbTracker.h:215
virtual void track(const vpImage< unsigned char > &I)=0
virtual double getInitialMu() const
Definition: vpMbTracker.h:286
virtual void resetTracker()=0
virtual void setOgreShowConfigDialog(bool showConfigDialog)
Definition: vpMbTracker.h:652
virtual double getAngleAppear() const
Definition: vpMbTracker.h:240
virtual void setMask(const vpImage< bool > &mask)
Definition: vpMbTracker.h:566
virtual void getCameraParameters(vpCameraParameters &cam) const
Definition: vpMbTracker.h:250
vpImage< unsigned char > m_I
Grayscale image buffer, used when passing color images.
Definition: vpMbTracker.h:225
unsigned int m_projectionErrorDisplayLength
Length of the arrows used to show the gradient and model orientation.
Definition: vpMbTracker.h:217
std::vector< vpMbtDistanceCylinder * > m_projectionErrorCylinders
Distance cylinder primitives for projection error.
Definition: vpMbTracker.h:200
virtual void init(const vpImage< unsigned char > &I)=0
virtual void setDisplayFeatures(bool displayF)
Definition: vpMbTracker.h:520
virtual vpHomogeneousMatrix getPose() const
Definition: vpMbTracker.h:425
bool useLodGeneral
True if LOD mode is enabled.
Definition: vpMbTracker.h:174
double minPolygonAreaThresholdGeneral
Minimum polygon area threshold for LOD mode (general setting)
Definition: vpMbTracker.h:181
std::map< std::string, std::string > mapOfParameterNames
Definition: vpMbTracker.h:184
bool m_computeInteraction
Definition: vpMbTracker.h:187
vpMatrix oJo
The Degrees of Freedom to estimate.
Definition: vpMbTracker.h:117
virtual void getPose(vpHomogeneousMatrix &cMo) const
Definition: vpMbTracker.h:416
virtual std::vector< std::vector< double > > getModelForDisplay(unsigned int width, unsigned int height, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, bool displayFullModel=false)=0
unsigned int nbLines
Number of lines in CAO model.
Definition: vpMbTracker.h:164
virtual void initFaceFromLines(vpMbtPolygon &polygon)=0
vpUniRand m_rand
Random number generator used in vpMbtDistanceLine::buildFrom()
Definition: vpMbTracker.h:229
vpMatrix covarianceMatrix
Covariance matrix.
Definition: vpMbTracker.h:132
double m_initialMu
Initial Mu for Levenberg Marquardt optimization loop.
Definition: vpMbTracker.h:195
bool computeProjError
Definition: vpMbTracker.h:135
virtual vpColVector getError() const =0
vpHomogeneousMatrix m_cMo
The current pose.
Definition: vpMbTracker.h:115
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace=0, const std::string &name="")=0
virtual vpMbtOptimizationMethod getOptimizationMethod() const
Definition: vpMbTracker.h:386
vpMatrix m_SobelX
Sobel kernel in X.
Definition: vpMbTracker.h:211
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, double radius, int idFace=0, const std::string &name="")=0
void setPoseSavingFilename(const std::string &filename)
Definition: vpMbTracker.h:664
unsigned int nbPoints
Number of points in CAO model.
Definition: vpMbTracker.h:162
vpCameraParameters m_cam
The camera parameters.
Definition: vpMbTracker.h:113
double projectionError
Definition: vpMbTracker.h:138
double m_stopCriteriaEpsilon
Epsilon threshold to stop the VVS optimization loop.
Definition: vpMbTracker.h:193
std::string modelFileName
Definition: vpMbTracker.h:122
bool useOgre
Use Ogre3d for visibility tests.
Definition: vpMbTracker.h:157
virtual double getAngleDisappear() const
Definition: vpMbTracker.h:243
virtual void setStopCriteriaEpsilon(const double eps)
Definition: vpMbTracker.h:574
vpMbHiddenFaces< vpMbtPolygon > faces
Set of faces describing the object.
Definition: vpMbTracker.h:145
virtual void setCameraParameters(const vpCameraParameters &cam)
Definition: vpMbTracker.h:490
virtual void setAngleDisappear(const double &a)
Definition: vpMbTracker.h:483
virtual void setCovarianceComputation(const bool &flag)
Definition: vpMbTracker.h:502
virtual void setInitialMu(double mu)
Definition: vpMbTracker.h:531
virtual void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
Definition: vpMbTracker.h:636
virtual void setScanLineVisibilityTest(const bool &v)
Definition: vpMbTracker.h:610
virtual vpMbHiddenFaces< vpMbtPolygon > & getFaces()
Definition: vpMbTracker.h:334
std::vector< vpMbtDistanceCircle * > m_projectionErrorCircles
Distance circle primitive for projection error.
Definition: vpMbTracker.h:202
std::string poseSavingFilename
Definition: vpMbTracker.h:128
unsigned int nbPolygonLines
Number of polygon lines in CAO model.
Definition: vpMbTracker.h:166
virtual vpColVector getRobustWeights() const =0
unsigned int m_projectionErrorDisplayThickness
Thickness of the arrows used to show the gradient and model orientation.
Definition: vpMbTracker.h:219
vpMbtOptimizationMethod m_optimizationMethod
Optimization method used.
Definition: vpMbTracker.h:142
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=0
virtual vpMatrix getCovarianceMatrix() const
Definition: vpMbTracker.h:267
bool displayFeatures
If true, the features are displayed.
Definition: vpMbTracker.h:140
virtual void setProjectionErrorDisplay(bool display)
Definition: vpMbTracker.h:592
double angleDisappears
Angle used to detect a face disappearance.
Definition: vpMbTracker.h:149
virtual unsigned int getNbPolygon() const
Definition: vpMbTracker.h:370
virtual void setLambda(double gain)
Definition: vpMbTracker.h:538
bool applyLodSettingInConfig
Definition: vpMbTracker.h:177
virtual double getProjectionError() const
Definition: vpMbTracker.h:312
double distFarClip
Distance for near clipping.
Definition: vpMbTracker.h:153
bool m_isoJoIdentity
Boolean to know if oJo is identity (for fast computation)
Definition: vpMbTracker.h:119
virtual vpMbtPolygon * getPolygon(unsigned int index)
Definition: vpMbTracker.h:397
virtual double getStopCriteriaEpsilon() const
Definition: vpMbTracker.h:427
bool useScanLine
Use Scanline for visibility tests.
Definition: vpMbTracker.h:160
vpMatrix m_SobelY
Sobel kernel in Y.
Definition: vpMbTracker.h:213
virtual void setProjectionErrorComputation(const bool &flag)
Definition: vpMbTracker.h:587
double angleAppears
Angle used to detect a face appearance.
Definition: vpMbTracker.h:147
virtual void setOptimizationMethod(const vpMbtOptimizationMethod &opt)
Definition: vpMbTracker.h:560
virtual void computeVVSInteractionMatrixAndResidu()=0
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)=0
bool m_projectionErrorOgreShowConfigDialog
Definition: vpMbTracker.h:205
virtual unsigned int getMaxIter() const
Definition: vpMbTracker.h:300
const vpImage< bool > * m_mask
Mask used to disable tracking on a part of image.
Definition: vpMbTracker.h:223
virtual double getLambda() const
Definition: vpMbTracker.h:293
virtual void setProjectionErrorDisplayArrowThickness(unsigned int thickness)
Definition: vpMbTracker.h:605
virtual void setAngleAppear(const double &a)
Definition: vpMbTracker.h:472
virtual void setGoodNbRayCastingAttemptsRatio(const double &ratio)
Definition: vpMbTracker.h:626
virtual void computeVVSInit()=0
bool computeCovariance
Flag used to specify if the covariance matrix has to be computed or not.
Definition: vpMbTracker.h:130
std::vector< vpMbtDistanceLine * > m_projectionErrorLines
Distance line primitives for projection error.
Definition: vpMbTracker.h:198
double distNearClip
Distance for near clipping.
Definition: vpMbTracker.h:151
bool m_sodb_init_called
Flag that indicates that SoDB::init(); was called.
Definition: vpMbTracker.h:227
unsigned int m_maxIter
Maximum number of iterations of the virtual visual servoing stage.
Definition: vpMbTracker.h:191
virtual void testTracking()=0
bool ogreShowConfigDialog
Definition: vpMbTracker.h:158
unsigned int nbCylinders
Number of cylinders in CAO model.
Definition: vpMbTracker.h:170
virtual void track(const vpImage< vpRGBa > &I)=0
unsigned int clippingFlag
Flags specifying which clipping to used.
Definition: vpMbTracker.h:155
unsigned int m_projectionErrorKernelSize
Kernel size used to compute the gradient orientation.
Definition: vpMbTracker.h:209
unsigned int nbCircles
Number of circles in CAO model.
Definition: vpMbTracker.h:172
vpMe m_projectionErrorMe
Moving-Edges parameters for projection error.
Definition: vpMbTracker.h:207
virtual double getFarClippingDistance() const
Definition: vpMbTracker.h:341
vpMbHiddenFaces< vpMbtPolygon > m_projectionErrorFaces
Set of faces describing the object, used for projection error.
Definition: vpMbTracker.h:204
virtual void initFaceFromCorners(vpMbtPolygon &polygon)=0
virtual unsigned int getClipping() const
Definition: vpMbTracker.h:258
Implementation of a polygon of the model used by the model-based tracker.
Definition: vpMbtPolygon.h:60
Definition: vpMe.h:134
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:79
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:203
Contains an M-estimator and various influence function.
Definition: vpRobust.h:84
Class for generating random numbers with uniform probability density.
Definition: vpUniRand.h:127