Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpMbDepthDenseTracker.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Model-based tracker using depth dense features.
32 */
33
34#ifndef VP_MBT_DEPTH_DENSE_TRACKER_H
35#define VP_MBT_DEPTH_DENSE_TRACKER_H
36
37#include <visp3/core/vpConfig.h>
38#include <visp3/core/vpPlane.h>
39#include <visp3/mbt/vpMbTracker.h>
40#include <visp3/mbt/vpMbtFaceDepthDense.h>
41#include <visp3/mbt/vpMbtTukeyEstimator.h>
42
43#if DEBUG_DISPLAY_DEPTH_DENSE
44#include <visp3/core/vpDisplay.h>
45#endif
46
63class VISP_EXPORT vpMbDepthDenseTracker : public virtual vpMbTracker
64{
65public:
68 virtual ~vpMbDepthDenseTracker() VP_OVERRIDE;
70
71 virtual void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
72 const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false) VP_OVERRIDE;
73
74 virtual void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
75 const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false) VP_OVERRIDE;
76
77 virtual inline vpColVector getError() const VP_OVERRIDE { return m_error_depthDense; }
78
79 virtual std::vector<std::vector<double> > getModelForDisplay(unsigned int width, unsigned int height,
80 const vpHomogeneousMatrix &cMo,
81 const vpCameraParameters &cam,
82 bool displayFullModel = false) VP_OVERRIDE;
83
84 virtual inline vpColVector getRobustWeights() const VP_OVERRIDE { return m_w_depthDense; }
85
86 virtual void init(const vpImage<unsigned char> &I) VP_OVERRIDE;
87
88 virtual void loadConfigFile(const std::string &configFile, bool verbose = true) VP_OVERRIDE;
89
90 void reInitModel(const vpImage<unsigned char> &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo,
91 bool verbose = false);
92#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON)
93 void reInitModel(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud, const std::string &cad_name,
94 const vpHomogeneousMatrix &cMo, bool verbose = false);
95#endif
96
97 virtual void resetTracker() VP_OVERRIDE;
98
99 virtual void setCameraParameters(const vpCameraParameters &camera) VP_OVERRIDE;
100
101 virtual void setDepthDenseFilteringMaxDistance(double maxDistance);
102 virtual void setDepthDenseFilteringMethod(int method);
103 virtual void setDepthDenseFilteringMinDistance(double minDistance);
104 virtual void setDepthDenseFilteringOccupancyRatio(double occupancyRatio);
105
106 inline void setDepthDenseSamplingStep(unsigned int stepX, unsigned int stepY)
107 {
108 if (stepX == 0 || stepY == 0) {
109 std::cerr << "stepX and stepY must be greater than zero!" << std::endl;
110 return;
111 }
112
115 }
116
117 virtual void setOgreVisibilityTest(const bool &v) VP_OVERRIDE;
118
119 virtual void setPose(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cdMo) VP_OVERRIDE;
120 virtual void setPose(const vpImage<vpRGBa> &I_color, const vpHomogeneousMatrix &cdMo) VP_OVERRIDE;
121#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON)
122 virtual void setPose(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud, const vpHomogeneousMatrix &cdMo);
123#endif
124
125 virtual void setScanLineVisibilityTest(const bool &v) VP_OVERRIDE;
126
127 void setUseDepthDenseTracking(const std::string &name, const bool &useDepthDenseTracking);
128
129 virtual void testTracking() VP_OVERRIDE;
130
131 virtual void track(const vpImage<unsigned char> &) VP_OVERRIDE;
132 virtual void track(const vpImage<vpRGBa> &) VP_OVERRIDE;
133#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON)
134 virtual void track(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud);
135#endif
136 virtual void track(const std::vector<vpColVector> &point_cloud, unsigned int width, unsigned int height);
137
138protected:
142 std::vector<vpMbtFaceDepthDense *> m_depthDenseListOfActiveFaces;
146 std::vector<vpMbtFaceDepthDense *> m_depthDenseFaces;
156 vpMbtTukeyEstimator<double> m_robust_depthDense;
161#if DEBUG_DISPLAY_DEPTH_DENSE
162 vpDisplay *m_debugDisp_depthDense;
163 vpImage<unsigned char> m_debugImage_depthDense;
164#endif
165
166 void addFace(vpMbtPolygon &polygon, bool alreadyClose);
167
168 void computeVisibility(unsigned int width, unsigned int height);
169
170 void computeVVS();
171 virtual void computeVVSInit() VP_OVERRIDE;
172 virtual void computeVVSInteractionMatrixAndResidu() VP_OVERRIDE;
173 virtual void computeVVSWeights();
175
176 virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace = 0,
177 const std::string &name = "") VP_OVERRIDE;
178
179 virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, double radius, int idFace = 0,
180 const std::string &name = "") VP_OVERRIDE;
181
182 virtual void initFaceFromCorners(vpMbtPolygon &polygon) VP_OVERRIDE;
183
184 virtual void initFaceFromLines(vpMbtPolygon &polygon) VP_OVERRIDE;
185
186#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON)
187 void segmentPointCloud(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud);
188#endif
189 void segmentPointCloud(const std::vector<vpColVector> &point_cloud, unsigned int width, unsigned int height);
190 void segmentPointCloud(const vpMatrix &point_cloud, unsigned int width, unsigned int height);
191};
192END_VISP_NAMESPACE
193#endif
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionalities.
Definition vpColor.h:157
Class that defines generic functionalities for display.
Definition vpDisplay.h:171
Implementation of an homogeneous matrix and operations on such kind of matrices.
Definition of the vpImage class member functions.
Definition vpImage.h:131
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
virtual void initFaceFromLines(vpMbtPolygon &polygon) VP_OVERRIDE
virtual void initFaceFromCorners(vpMbtPolygon &polygon) VP_OVERRIDE
void segmentPointCloud(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &point_cloud)
vpMbtTukeyEstimator< double > m_robust_depthDense
Tukey M-Estimator.
void computeVisibility(unsigned int width, unsigned int height)
vpColVector m_weightedError_depthDense
Weighted error.
unsigned int m_depthDenseSamplingStepY
Sampling step in y-direction.
virtual vpColVector getError() const VP_OVERRIDE
vpMbHiddenFaces< vpMbtPolygon > m_depthDenseHiddenFacesDisplay
Set of faces describing the object used only for display with scan line.
unsigned int m_depthDenseSamplingStepX
Sampling step in x-direction.
virtual vpColVector getRobustWeights() const VP_OVERRIDE
vpColVector m_error_depthDense
(s - s*)
virtual void computeVVSInteractionMatrixAndResidu() VP_OVERRIDE
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, double radius, int idFace=0, const std::string &name="") VP_OVERRIDE
vpMatrix m_L_depthDense
Interaction matrix.
std::vector< vpMbtFaceDepthDense * > m_depthDenseListOfActiveFaces
List of current active (visible and features extracted) faces.
void setDepthDenseSamplingStep(unsigned int stepX, unsigned int stepY)
void addFace(vpMbtPolygon &polygon, bool alreadyClose)
unsigned int m_denseDepthNbFeatures
Nb features.
vpColVector m_w_depthDense
Robust weights.
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace=0, const std::string &name="") VP_OVERRIDE
std::vector< vpMbtFaceDepthDense * > m_depthDenseFaces
List of faces.
Implementation of the polygons management for the model-based trackers.
virtual void track(const vpImage< unsigned char > &I)=0
virtual void resetTracker()=0
virtual void init(const vpImage< unsigned char > &I)=0
virtual std::vector< std::vector< double > > getModelForDisplay(unsigned int width, unsigned int height, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, bool displayFullModel=false)=0
virtual void setScanLineVisibilityTest(const bool &v)
virtual void setOgreVisibilityTest(const bool &v)
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)=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
virtual void computeVVSInit()=0
virtual void testTracking()=0
vpMbTracker & operator=(const vpMbTracker &tracker)
virtual void loadConfigFile(const std::string &configFile, bool verbose=true)
Implementation of a polygon of the model used by the model-based tracker.
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition vpPoint.h:79