Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpMbtFaceDepthNormal Class Reference

#include <visp3/mbt/vpMbtFaceDepthNormal.h>

Public Types

enum  vpFaceCentroidType { GEOMETRIC_CENTROID, MEAN_CENTROID }
 
enum  vpFeatureEstimationType { ROBUST_FEATURE_ESTIMATION = 0, ROBUST_SVD_PLANE_ESTIMATION = 1, PCL_PLANE_ESTIMATION = 2 }
 

Public Member Functions

 vpMbtFaceDepthNormal ()
 
virtual ~vpMbtFaceDepthNormal ()
 
void addLine (vpPoint &p1, vpPoint &p2, vpMbHiddenFaces< vpMbtPolygon > *const faces, int polygon=-1, std::string name="")
 
bool computeDesiredFeatures (const vpHomogeneousMatrix &cMo, const unsigned int width, const unsigned int height, const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &point_cloud, vpColVector &desired_features, const unsigned int stepX, const unsigned int stepY, const vpImage< bool > *mask=NULL)
 
bool computeDesiredFeatures (const vpHomogeneousMatrix &cMo, const unsigned int width, const unsigned int height, const std::vector< vpColVector > &point_cloud, vpColVector &desired_features, const unsigned int stepX, const unsigned int stepY, const vpImage< bool > *mask=NULL)
 
void computeInteractionMatrix (const vpHomogeneousMatrix &cMo, vpMatrix &L, vpColVector &features)
 
void computeVisibility ()
 
void computeVisibilityDisplay ()
 
void computeNormalVisibility (const double nx, const double ny, const double nz, const vpColVector &centroid_point, vpColVector &face_normal)
 
void computeNormalVisibility (const float nx, const float ny, const float nz, const pcl::PointXYZ &centroid_point, pcl::PointXYZ &face_normal)
 
void computeNormalVisibility (const double nx, const double ny, const double nz, const vpHomogeneousMatrix &cMo, const vpCameraParameters &camera, vpColVector &correct_normal, vpPoint &centroid)
 
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)
 
void display (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)
 
void displayFeature (const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const double scale=0.05, const unsigned int thickness=1)
 
void displayFeature (const vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const double scale=0.05, const unsigned int thickness=1)
 
bool isTracked () const
 
bool isVisible () const
 
void setCameraParameters (const vpCameraParameters &camera)
 
void setFaceCentroidMethod (const vpFaceCentroidType &method)
 
void setFeatureEstimationMethod (const vpFeatureEstimationType &method)
 
void setPclPlaneEstimationMethod (const int method)
 
void setPclPlaneEstimationRansacMaxIter (const int maxIter)
 
void setPclPlaneEstimationRansacThreshold (const double threshold)
 
void setScanLineVisibilityTest (const bool v)
 
void setTracked (const bool tracked)
 

Public Attributes

vpCameraParameters m_cam
 
unsigned int m_clippingFlag
 
double m_distFarClip
 
double m_distNearClip
 
vpMbHiddenFaces< vpMbtPolygon > * m_hiddenFace
 
vpPlane m_planeObject
 
vpMbtPolygonm_polygon
 
bool m_useScanLine
 

Protected Member Functions

bool computeDesiredFeaturesPCL (const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &point_cloud_face, vpColVector &desired_features, vpColVector &desired_normal, vpColVector &centroid_point)
 
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 &centroid_point)
 
void computeDesiredFeaturesSVD (const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &desired_features, vpColVector &desired_normal, vpColVector &centroid_point)
 
void computeDesiredNormalAndCentroid (const vpHomogeneousMatrix &cMo, const vpColVector &desired_normal, const vpColVector &centroid_point)
 
bool computePolygonCentroid (const std::vector< vpPoint > &points, vpPoint &centroid)
 
void computeROI (const vpHomogeneousMatrix &cMo, const unsigned int width, const unsigned int height, std::vector< vpImagePoint > &roiPts)
 
void estimateFeatures (const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &x_estimated, std::vector< double > &weights)
 
void estimatePlaneEquationSVD (const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &plane_equation_estimated, vpColVector &centroid)
 
bool samePoint (const vpPoint &P1, const vpPoint &P2) const
 

Protected Attributes

bool m_faceActivated
 
vpFaceCentroidType m_faceCentroidMethod
 
vpPoint m_faceDesiredCentroid
 
vpPoint m_faceDesiredNormal
 
vpFeatureEstimationType m_featureEstimationMethod
 
bool m_isTrackedDepthNormalFace
 
bool m_isVisible
 
std::vector< vpMbtDistanceLine * > m_listOfFaceLines
 
vpPlane m_planeCamera
 
int m_pclPlaneEstimationMethod
 
int m_pclPlaneEstimationRansacMaxIter
 
double m_pclPlaneEstimationRansacThreshold
 
std::vector< PolygonLine > m_polygonLines
 

Detailed Description

Definition at line 53 of file vpMbtFaceDepthNormal.h.

Member Enumeration Documentation

Enumerator
GEOMETRIC_CENTROID 

Compute the geometric centroid.

MEAN_CENTROID 

Compute the mean centroid.

Definition at line 56 of file vpMbtFaceDepthNormal.h.

Enumerator
ROBUST_FEATURE_ESTIMATION 
ROBUST_SVD_PLANE_ESTIMATION 
PCL_PLANE_ESTIMATION 

Definition at line 61 of file vpMbtFaceDepthNormal.h.

Constructor & Destructor Documentation

vpMbtFaceDepthNormal::vpMbtFaceDepthNormal ( )

Definition at line 58 of file vpMbtFaceDepthNormal.cpp.

vpMbtFaceDepthNormal::~vpMbtFaceDepthNormal ( )
virtual

Definition at line 69 of file vpMbtFaceDepthNormal.cpp.

References m_listOfFaceLines.

Member Function Documentation

void vpMbtFaceDepthNormal::addLine ( vpPoint P1,
vpPoint P2,
vpMbHiddenFaces< vpMbtPolygon > *const  faces,
int  polygon = -1,
std::string  name = "" 
)

Add a line belonging to the $ index $ the polygon to the list of lines. It is defined by its two extremities.

If the line already exists, the ploygone's index is added to the list of polygon to which it belongs.

Parameters
P1: The first extremity of the line.
P2: The second extremity of the line.
faces: Pointer to vpMbHiddenFaces.
polygon: The index of the polygon to which the line belongs.
name: the optional name of the line

Definition at line 89 of file vpMbtFaceDepthNormal.cpp.

References vpMbtDistanceLine::addPolygon(), vpMbtDistanceLine::buildFrom(), vpPolygon3D::FAR_CLIPPING, vpMbtDistanceLine::getPolygon(), vpMbtDistanceLine::hiddenface, m_cam, m_clippingFlag, m_distFarClip, m_distNearClip, m_listOfFaceLines, m_polygonLines, m_useScanLine, vpPolygon3D::NEAR_CLIPPING, vpPolygon3D::NO_CLIPPING, vpMbtDistanceLine::p1, vpMbtDistanceLine::p2, samePoint(), vpMbtDistanceLine::setCameraParameters(), vpPolygon3D::setClipping(), vpPolygon3D::setFarClippingDistance(), vpMbtDistanceLine::setIndex(), vpMbtDistanceLine::setName(), vpPolygon3D::setNearClippingDistance(), and vpMbtDistanceLine::useScanLine.

Referenced by vpMbDepthNormalTracker::addFace().

bool vpMbtFaceDepthNormal::computeDesiredFeaturesPCL ( const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &  point_cloud_face,
vpColVector desired_features,
vpColVector desired_normal,
vpColVector centroid_point 
)
protected
void vpMbtFaceDepthNormal::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 centroid_point 
)
protected

Definition at line 531 of file vpMbtFaceDepthNormal.cpp.

References computeNormalVisibility(), and estimateFeatures().

Referenced by computeDesiredFeatures().

void vpMbtFaceDepthNormal::computeDesiredFeaturesSVD ( const std::vector< double > &  point_cloud_face,
const vpHomogeneousMatrix cMo,
vpColVector desired_features,
vpColVector desired_normal,
vpColVector centroid_point 
)
protected
void vpMbtFaceDepthNormal::computeDesiredNormalAndCentroid ( const vpHomogeneousMatrix cMo,
const vpColVector desired_normal,
const vpColVector centroid_point 
)
protected
void vpMbtFaceDepthNormal::computeInteractionMatrix ( const vpHomogeneousMatrix cMo,
vpMatrix L,
vpColVector features 
)
void vpMbtFaceDepthNormal::computeNormalVisibility ( const double  nx,
const double  ny,
const double  nz,
const vpColVector centroid_point,
vpColVector face_normal 
)
void vpMbtFaceDepthNormal::computeNormalVisibility ( const float  nx,
const float  ny,
const float  nz,
const pcl::PointXYZ &  centroid_point,
pcl::PointXYZ &  face_normal 
)

Definition at line 812 of file vpMbtFaceDepthNormal.cpp.

References vpColVector::dotProd(), and vpColVector::normalize().

bool vpMbtFaceDepthNormal::computePolygonCentroid ( const std::vector< vpPoint > &  points,
vpPoint centroid 
)
protected
void vpMbtFaceDepthNormal::computeVisibility ( )
void vpMbtFaceDepthNormal::computeVisibilityDisplay ( )
void vpMbtFaceDepthNormal::display ( const vpImage< unsigned char > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters cam,
const vpColor col,
const unsigned int  thickness = 1,
const bool  displayFullModel = false 
)
void vpMbtFaceDepthNormal::display ( const vpImage< vpRGBa > &  I,
const vpHomogeneousMatrix cMo,
const vpCameraParameters cam,
const vpColor col,
const unsigned int  thickness = 1,
const bool  displayFullModel = false 
)
void vpMbtFaceDepthNormal::estimateFeatures ( const std::vector< double > &  point_cloud_face,
const vpHomogeneousMatrix cMo,
vpColVector x_estimated,
std::vector< double > &  weights 
)
protected
void vpMbtFaceDepthNormal::estimatePlaneEquationSVD ( const std::vector< double > &  point_cloud_face,
const vpHomogeneousMatrix cMo,
vpColVector plane_equation_estimated,
vpColVector centroid 
)
protected
bool vpMbtFaceDepthNormal::isTracked ( ) const
inline

Definition at line 137 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::segmentPointCloud().

bool vpMbtFaceDepthNormal::isVisible ( ) const
inline
bool vpMbtFaceDepthNormal::samePoint ( const vpPoint P1,
const vpPoint P2 
) const
protected

Check if two vpPoints are similar.

To be similar : $ (X_1 - X_2)^2 + (Y_1 - Y_2)^2 + (Z_1 - Z_2)^2 < epsilon $.

Parameters
P1: The first point to compare
P2: The second point to compare

Definition at line 1496 of file vpMbtFaceDepthNormal.cpp.

References vpPoint::get_oX(), vpPoint::get_oY(), and vpPoint::get_oZ().

Referenced by addLine().

void vpMbtFaceDepthNormal::setCameraParameters ( const vpCameraParameters camera)

Definition at line 1509 of file vpMbtFaceDepthNormal.cpp.

References m_cam, and m_listOfFaceLines.

void vpMbtFaceDepthNormal::setFaceCentroidMethod ( const vpFaceCentroidType method)
inline

Definition at line 143 of file vpMbtFaceDepthNormal.h.

void vpMbtFaceDepthNormal::setFeatureEstimationMethod ( const vpFeatureEstimationType method)
inline

Definition at line 145 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace().

void vpMbtFaceDepthNormal::setPclPlaneEstimationMethod ( const int  method)
inline

Definition at line 147 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace().

void vpMbtFaceDepthNormal::setPclPlaneEstimationRansacMaxIter ( const int  maxIter)
inline

Definition at line 149 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace().

void vpMbtFaceDepthNormal::setPclPlaneEstimationRansacThreshold ( const double  threshold)
inline

Definition at line 151 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace().

void vpMbtFaceDepthNormal::setScanLineVisibilityTest ( const bool  v)

Definition at line 1519 of file vpMbtFaceDepthNormal.cpp.

References m_listOfFaceLines, and m_useScanLine.

void vpMbtFaceDepthNormal::setTracked ( const bool  tracked)
inline

Definition at line 158 of file vpMbtFaceDepthNormal.h.

References vpPolygon3D::p.

Referenced by vpMbDepthNormalTracker::setUseDepthNormalTracking().

Member Data Documentation

vpCameraParameters vpMbtFaceDepthNormal::m_cam

Camera intrinsic parameters.

Definition at line 70 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace(), addLine(), computeDesiredFeatures(), computeROI(), and setCameraParameters().

unsigned int vpMbtFaceDepthNormal::m_clippingFlag

Flags specifying which clipping to used.

Definition at line 72 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace(), addLine(), and computeROI().

double vpMbtFaceDepthNormal::m_distFarClip

Distance for near clipping.

Definition at line 74 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace(), and addLine().

double vpMbtFaceDepthNormal::m_distNearClip

Distance for near clipping.

Definition at line 76 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace(), and addLine().

bool vpMbtFaceDepthNormal::m_faceActivated
protected

True if the face should be considered by the tracker.

Definition at line 237 of file vpMbtFaceDepthNormal.h.

Referenced by computeDesiredFeatures(), and displayFeature().

vpFaceCentroidType vpMbtFaceDepthNormal::m_faceCentroidMethod
protected

Method to compute the face centroid for the current features.

Definition at line 239 of file vpMbtFaceDepthNormal.h.

Referenced by computeNormalVisibility().

vpPoint vpMbtFaceDepthNormal::m_faceDesiredCentroid
protected

Desired centroid (computed from the sensor)

Definition at line 241 of file vpMbtFaceDepthNormal.h.

Referenced by computeDesiredNormalAndCentroid(), and displayFeature().

vpPoint vpMbtFaceDepthNormal::m_faceDesiredNormal
protected

Face (normalized) normal (computed from the sensor)

Definition at line 243 of file vpMbtFaceDepthNormal.h.

Referenced by computeDesiredNormalAndCentroid(), and displayFeature().

vpFeatureEstimationType vpMbtFaceDepthNormal::m_featureEstimationMethod
protected

Method to estimate the desired features.

Definition at line 245 of file vpMbtFaceDepthNormal.h.

Referenced by computeDesiredFeatures().

vpMbHiddenFaces<vpMbtPolygon>* vpMbtFaceDepthNormal::m_hiddenFace

Pointer to the list of faces.

Definition at line 78 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace(), computeDesiredFeatures(), and computeROI().

bool vpMbtFaceDepthNormal::m_isTrackedDepthNormalFace
protected

Definition at line 247 of file vpMbtFaceDepthNormal.h.

Referenced by display(), and displayFeature().

bool vpMbtFaceDepthNormal::m_isVisible
protected

Definition at line 249 of file vpMbtFaceDepthNormal.h.

Referenced by computeVisibility(), and displayFeature().

std::vector<vpMbtDistanceLine *> vpMbtFaceDepthNormal::m_listOfFaceLines
protected
int vpMbtFaceDepthNormal::m_pclPlaneEstimationMethod
protected

PCL plane estimation method.

Definition at line 256 of file vpMbtFaceDepthNormal.h.

Referenced by computeDesiredFeaturesPCL().

int vpMbtFaceDepthNormal::m_pclPlaneEstimationRansacMaxIter
protected

PCL pane estimation max number of iterations.

Definition at line 258 of file vpMbtFaceDepthNormal.h.

Referenced by computeDesiredFeaturesPCL().

double vpMbtFaceDepthNormal::m_pclPlaneEstimationRansacThreshold
protected

PCL plane estimation RANSAC threshold.

Definition at line 260 of file vpMbtFaceDepthNormal.h.

Referenced by computeDesiredFeaturesPCL().

vpPlane vpMbtFaceDepthNormal::m_planeCamera
protected

Plane equation described in the camera frame and updated with the current pose

Definition at line 254 of file vpMbtFaceDepthNormal.h.

Referenced by computeInteractionMatrix(), displayFeature(), estimateFeatures(), and estimatePlaneEquationSVD().

vpPlane vpMbtFaceDepthNormal::m_planeObject

Plane equation described in the object frame.

Definition at line 80 of file vpMbtFaceDepthNormal.h.

Referenced by vpMbDepthNormalTracker::addFace(), computeInteractionMatrix(), displayFeature(), estimateFeatures(), and estimatePlaneEquationSVD().

std::vector<PolygonLine> vpMbtFaceDepthNormal::m_polygonLines
protected

Definition at line 262 of file vpMbtFaceDepthNormal.h.

Referenced by addLine(), and computeROI().

bool vpMbtFaceDepthNormal::m_useScanLine