34#ifndef VP_MBT_FACE_DEPTH_NORMAL_H
35#define VP_MBT_FACE_DEPTH_NORMAL_H
39#include <visp3/core/vpConfig.h>
40#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS)
41#include <pcl/point_cloud.h>
42#include <pcl/point_types.h>
45#include <visp3/core/vpPlane.h>
46#include <visp3/mbt/vpMbTracker.h>
47#include <visp3/mbt/vpMbtDistanceLine.h>
49#define DEBUG_DISPLAY_DEPTH_NORMAL 0
87#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS)
115 int polygon = -1, std::string name =
"");
117#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS)
119 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud,
120 vpColVector &desired_features,
unsigned int stepX,
unsigned int stepY
121#
if DEBUG_DISPLAY_DEPTH_NORMAL
129 const std::vector<vpColVector> &point_cloud,
vpColVector &desired_features,
130 unsigned int stepX,
unsigned int stepY
131#
if DEBUG_DISPLAY_DEPTH_NORMAL
139 unsigned int stepX,
unsigned int stepY
140#
if DEBUG_DISPLAY_DEPTH_NORMAL
156#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS)
158 pcl::PointXYZ &face_normal);
164 const vpColor &col,
unsigned int thickness = 1,
bool displayFullModel =
false);
166 const vpColor &col,
unsigned int thickness = 1,
bool displayFullModel =
false);
169 double scale = 0.05,
unsigned int thickness = 1);
171 double scale = 0.05,
unsigned int thickness = 1);
174 double scale = 0.05);
176 std::vector<std::vector<double> >
getModelForDisplay(
unsigned int width,
unsigned int height,
178 bool displayFullModel =
false);
199 void setScanLineVisibilityTest(
bool v);
218 PolygonLine() : m_p1(nullptr), m_p2(nullptr), m_poly(), m_imPt1(), m_imPt2() { }
220 PolygonLine(
const PolygonLine &polyLine)
221 : m_p1(nullptr), m_p2(nullptr), m_poly(polyLine.m_poly), m_imPt1(polyLine.m_imPt1), m_imPt2(polyLine.m_imPt2)
227 PolygonLine &operator=(PolygonLine other)
234 void swap(PolygonLine &first, PolygonLine &second)
237 swap(first.m_p1, second.m_p1);
238 swap(first.m_p2, second.m_p2);
239 swap(first.m_poly, second.m_poly);
240 swap(first.m_imPt1, second.m_imPt1);
241 swap(first.m_imPt2, second.m_imPt2);
245 template <
class T>
class Mat33
250 Mat33() :
data(9) { }
252 inline T operator[](
const size_t i)
const {
return data[
i]; }
254 inline T &operator[](
const size_t i) {
return data[
i]; }
256 Mat33 inverse()
const
259 T det =
data[0] * (
data[4] *
data[8] -
data[7] *
data[5]) - data[1] * (data[3] * data[8] - data[5] * data[6]) +
307#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS)
325 std::vector<vpImagePoint> &roiPts
326#
if DEBUG_DISPLAY_DEPTH_NORMAL
328 std::vector<std::vector<vpImagePoint> > &roiPts_vec
333 vpColVector &x_estimated, std::vector<double> &weights);
342#ifdef VISP_HAVE_NLOHMANN_JSON
343#include VISP_NLOHMANN_JSON(json.hpp)
345#if defined(__clang__)
348# pragma clang diagnostic push
349# pragma clang diagnostic ignored "-Wexit-time-destructors"
352#if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_COMMON) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS)
365#if defined(__clang__)
366# pragma clang diagnostic pop
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionalities.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition of the vpImage class member functions.
Implementation of a matrix and operations on matrices.
Implementation of the polygons management for the model-based trackers.
double m_pclPlaneEstimationRansacThreshold
PCL plane estimation RANSAC threshold.
int m_pclPlaneEstimationMethod
PCL plane estimation method.
double m_distNearClip
Distance for near clipping.
void computeInteractionMatrix(const vpHomogeneousMatrix &cMo, vpMatrix &L, vpColVector &features)
std::vector< std::vector< double > > getModelForDisplay(unsigned int width, unsigned int height, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, bool displayFullModel=false)
void addLine(vpPoint &p1, vpPoint &p2, vpMbHiddenFaces< vpMbtPolygon > *const faces, vpUniRand &rand_gen, int polygon=-1, std::string name="")
void computeDesiredFeaturesSVD(const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &desired_features, vpColVector &desired_normal, vpColVector ¢roid_point)
double m_distFarClip
Distance for near clipping.
bool samePoint(const vpPoint &P1, const vpPoint &P2) const
void displayFeature(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double scale=0.05, unsigned int thickness=1)
vpMbHiddenFaces< vpMbtPolygon > * m_hiddenFace
Pointer to the list of faces.
std::vector< std::vector< double > > getFeaturesForDisplay(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double scale=0.05)
bool computePolygonCentroid(const std::vector< vpPoint > &points, vpPoint ¢roid)
void computeROI(const vpHomogeneousMatrix &cMo, unsigned int width, unsigned int height, std::vector< vpImagePoint > &roiPts)
void estimatePlaneEquationSVD(const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &plane_equation_estimated, vpColVector ¢roid)
std::vector< vpMbtDistanceLine * > m_listOfFaceLines
void computeDesiredNormalAndCentroid(const vpHomogeneousMatrix &cMo, const vpColVector &desired_normal, const vpColVector ¢roid_point)
void setPclPlaneEstimationMethod(int method)
vpMbtFaceDepthNormal & operator=(const vpMbtFaceDepthNormal &mbt_face)
bool m_isTrackedDepthNormalFace
vpFeatureEstimationType m_featureEstimationMethod
Method to estimate the desired features.
void setPclPlaneEstimationRansacThreshold(double threshold)
vpMbtPolygon * m_polygon
Polygon defining the face.
vpPoint m_faceDesiredCentroid
Desired centroid (computed from the sensor).
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
vpCameraParameters m_cam
Camera intrinsic parameters.
@ ROBUST_FEATURE_ESTIMATION
Robust scheme to estimate the normal of the plane.
@ ROBUST_SVD_PLANE_ESTIMATION
Use SVD and robust scheme to estimate the normal of the plane.
@ PCL_PLANE_ESTIMATION
Use PCL to estimate the normal of the plane.
vpPlane m_planeObject
Plane equation described in the object frame.
void computeVisibilityDisplay()
bool m_faceActivated
True if the face should be considered by the tracker.
@ GEOMETRIC_CENTROID
Compute the geometric centroid.
@ MEAN_CENTROID
Compute the mean centroid.
vpFaceCentroidType m_faceCentroidMethod
Method to compute the face centroid for the current features.
bool planeIsInvalid(const vpHomogeneousMatrix &cMo, double maxAngle)
int m_pclPlaneEstimationRansacMaxIter
PCL pane estimation max number of iterations.
unsigned int m_clippingFlag
Flags specifying which clipping to used.
void computeDesiredFeaturesRobustFeatures(const std::vector< double > &point_cloud_face_custom, const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &desired_features, vpColVector &desired_normal, vpColVector ¢roid_point)
void setTracked(bool tracked)
vpPoint m_faceDesiredNormal
Face (normalized) normal (computed from the sensor).
void estimateFeatures(const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &x_estimated, std::vector< double > &weights)
void setFeatureEstimationMethod(const vpFeatureEstimationType &method)
std::vector< PolygonLine > m_polygonLines
void setFaceCentroidMethod(const vpFaceCentroidType &method)
bool computeDesiredFeaturesPCL(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &point_cloud_face, vpColVector &desired_features, vpColVector &desired_normal, vpColVector ¢roid_point)
void setPclPlaneEstimationRansacMaxIter(int maxIter)
void computeNormalVisibility(double nx, double ny, double nz, const vpColVector ¢roid_point, vpColVector &face_normal)
bool m_useScanLine
Scan line visibility.
bool computeDesiredFeatures(const vpHomogeneousMatrix &cMo, unsigned int width, unsigned int height, const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &point_cloud, vpColVector &desired_features, unsigned int stepX, unsigned int stepY, const vpImage< bool > *mask=nullptr)
Implementation of a polygon of the model used by the model-based tracker.
This class defines the container for a plane geometrical structure.
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
vpPoint * p
corners in the object frame
Class for generating random numbers with uniform probability density.