36 #ifndef __vpMbtFaceDepthNormal_h_ 37 #define __vpMbtFaceDepthNormal_h_ 41 #include <visp3/core/vpConfig.h> 43 #include <pcl/point_cloud.h> 44 #include <pcl/point_types.h> 47 #include <visp3/core/vpPlane.h> 48 #include <visp3/mbt/vpMbTracker.h> 49 #include <visp3/mbt/vpMbtDistanceLine.h> 51 #define DEBUG_DISPLAY_DEPTH_NORMAL 0 62 ROBUST_FEATURE_ESTIMATION = 0,
63 ROBUST_SVD_PLANE_ESTIMATION = 1,
65 PCL_PLANE_ESTIMATION = 2
90 std::string name =
"");
93 bool computeDesiredFeatures(
const vpHomogeneousMatrix &cMo,
const unsigned int width,
const unsigned int height,
94 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud,
95 vpColVector &desired_features,
const unsigned int stepX,
const unsigned int stepY
96 #
if DEBUG_DISPLAY_DEPTH_NORMAL
102 bool computeDesiredFeatures(
const vpHomogeneousMatrix &cMo,
const unsigned int width,
const unsigned int height,
103 const std::vector<vpColVector> &point_cloud,
vpColVector &desired_features,
104 const unsigned int stepX,
const unsigned int stepY
105 #
if DEBUG_DISPLAY_DEPTH_NORMAL
113 void computeVisibility();
114 void computeVisibilityDisplay();
116 void computeNormalVisibility(
const double nx,
const double ny,
const double nz,
const vpColVector ¢roid_point,
119 void computeNormalVisibility(
const float nx,
const float ny,
const float nz,
const pcl::PointXYZ ¢roid_point,
120 pcl::PointXYZ &face_normal);
122 void computeNormalVisibility(
const double nx,
const double ny,
const double nz,
const vpHomogeneousMatrix &cMo,
126 const vpColor &col,
const unsigned int thickness = 1,
const bool displayFullModel =
false);
128 const vpColor &col,
const unsigned int thickness = 1,
const bool displayFullModel =
false);
131 const double scale = 0.05,
const unsigned int thickness = 1);
133 const double scale = 0.05,
const unsigned int thickness = 1);
149 m_pclPlaneEstimationRansacThreshold = threshold;
152 void setScanLineVisibilityTest(
const bool v);
169 PolygonLine() : m_p1(NULL), m_p2(NULL), m_poly(), m_imPt1(), m_imPt2() {}
171 PolygonLine(
const PolygonLine &polyLine)
172 : m_p1(NULL), m_p2(NULL), m_poly(polyLine.m_poly), m_imPt1(polyLine.m_imPt1), m_imPt2(polyLine.m_imPt2)
178 PolygonLine &operator=(PolygonLine other)
185 void swap(PolygonLine &first, PolygonLine &second)
188 swap(first.m_p1, second.m_p1);
189 swap(first.m_p2, second.m_p2);
190 swap(first.m_poly, second.m_poly);
191 swap(first.m_imPt1, second.m_imPt1);
192 swap(first.m_imPt2, second.m_imPt2);
196 template <
class T>
class Mat33
203 inline T operator[](
const size_t i)
const {
return data[i]; }
205 inline T &operator[](
const size_t i) {
return data[i]; }
207 Mat33 inverse()
const 210 T det = data[0] * (data[4] * data[8] - data[7] * data[5]) - data[1] * (data[3] * data[8] - data[5] * data[6]) +
211 data[2] * (data[3] * data[7] - data[4] * data[6]);
215 minv[0] = (data[4] * data[8] - data[7] * data[5]) * invdet;
216 minv[1] = (data[2] * data[7] - data[1] * data[8]) * invdet;
217 minv[2] = (data[1] * data[5] - data[2] * data[4]) * invdet;
218 minv[3] = (data[5] * data[6] - data[3] * data[8]) * invdet;
219 minv[4] = (data[0] * data[8] - data[2] * data[6]) * invdet;
220 minv[5] = (data[3] * data[2] - data[0] * data[5]) * invdet;
221 minv[6] = (data[3] * data[7] - data[6] * data[4]) * invdet;
222 minv[7] = (data[6] * data[1] - data[0] * data[7]) * invdet;
223 minv[8] = (data[0] * data[4] - data[3] * data[1]) * invdet;
259 bool computeDesiredFeaturesPCL(
const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud_face,
263 void computeDesiredFeaturesRobustFeatures(
const std::vector<double> &point_cloud_face_custom,
267 void computeDesiredFeaturesSVD(
const std::vector<double> &point_cloud_face,
const vpHomogeneousMatrix &cMo,
273 bool computePolygonCentroid(
const std::vector<vpPoint> &points,
vpPoint ¢roid);
275 void computeROI(
const vpHomogeneousMatrix &cMo,
const unsigned int width,
const unsigned int height,
276 std::vector<vpImagePoint> &roiPts
277 #
if DEBUG_DISPLAY_DEPTH_NORMAL
279 std::vector<std::vector<vpImagePoint> > &roiPts_vec
283 void estimateFeatures(
const std::vector<double> &point_cloud_face,
const vpHomogeneousMatrix &cMo,
284 vpColVector &x_estimated, std::vector<double> &weights);
286 void estimatePlaneEquationSVD(
const std::vector<double> &point_cloud_face,
const vpHomogeneousMatrix &cMo,
vpFeatureEstimationType m_featureEstimationMethod
Method to estimate the desired features.
Implementation of a matrix and operations on matrices.
Implementation of an homogeneous matrix and operations on such kind of matrices.
int m_pclPlaneEstimationMethod
PCL plane estimation method.
unsigned int m_clippingFlag
Flags specifying which clipping to used.
Class to define colors available for display functionnalities.
int m_pclPlaneEstimationRansacMaxIter
PCL pane estimation max number of iterations.
vpPoint * p
corners in the object frame
void setFaceCentroidMethod(const vpFaceCentroidType &method)
double m_distNearClip
Distance for near clipping.
bool m_useScanLine
Scan line visibility.
vpCameraParameters m_cam
Camera intrinsic parameters.
Class that defines what is a point.
bool m_faceActivated
True if the face should be considered by the tracker.
void setPclPlaneEstimationRansacThreshold(const double threshold)
vpMbtPolygon * m_polygon
Polygon defining the face.
Implementation of a polygon of the model used by the model-based tracker.
vpMbHiddenFaces< vpMbtPolygon > * m_hiddenFace
Pointer to the list of faces.
Generic class defining intrinsic camera parameters.
vpPoint m_faceDesiredNormal
Face (normalized) normal (computed from the sensor)
double m_distFarClip
Distance for near clipping.
std::vector< vpMbtDistanceLine * > m_listOfFaceLines
void setFeatureEstimationMethod(const vpFeatureEstimationType &method)
std::vector< PolygonLine > m_polygonLines
vpFaceCentroidType m_faceCentroidMethod
Method to compute the face centroid for the current features.
void setPclPlaneEstimationMethod(const int method)
Implementation of column vector and the associated operations.
void setPclPlaneEstimationRansacMaxIter(const int maxIter)
vpPoint m_faceDesiredCentroid
Desired centroid (computed from the sensor)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Compute the geometric centroid.
This class defines the container for a plane geometrical structure.
vpPlane m_planeObject
Plane equation described in the object frame.
bool isvisible
flag to specify whether the face is visible or not
double m_pclPlaneEstimationRansacThreshold
PCL plane estimation RANSAC threshold.