41 #ifndef PCL_NORMAL_3D_H_ 42 #define PCL_NORMAL_3D_H_ 44 #include <pcl/features/feature.h> 45 #include <pcl/common/centroid.h> 59 template <
typename Po
intT>
inline bool 61 Eigen::Vector4f &plane_parameters,
float &curvature)
66 Eigen::Vector4f xyz_centroid;
68 if (cloud.
size () < 3 ||
71 plane_parameters.setConstant (std::numeric_limits<float>::quiet_NaN ());
72 curvature = std::numeric_limits<float>::quiet_NaN ();
92 template <
typename Po
intT>
inline bool 94 Eigen::Vector4f &plane_parameters,
float &curvature)
99 Eigen::Vector4f xyz_centroid;
100 if (indices.size () < 3 ||
103 plane_parameters.setConstant (std::numeric_limits<float>::quiet_NaN ());
104 curvature = std::numeric_limits<float>::quiet_NaN ();
120 template <
typename Po
intT,
typename Scalar>
inline void 122 Eigen::Matrix<Scalar, 4, 1>& normal)
124 Eigen::Matrix <Scalar, 4, 1> vp (vp_x - point.x, vp_y - point.y, vp_z - point.z, 0);
127 float cos_theta = vp.dot (normal);
135 normal[3] = -1 * normal.dot (point.getVector4fMap ());
147 template <
typename Po
intT,
typename Scalar>
inline void 149 Eigen::Matrix<Scalar, 3, 1>& normal)
151 Eigen::Matrix <Scalar, 3, 1> vp (vp_x - point.x, vp_y - point.y, vp_z - point.z);
154 if (vp.dot (normal) < 0)
168 template <
typename Po
intT>
inline void 170 float &nx,
float &ny,
float &nz)
178 float cos_theta = (vp_x * nx + vp_y * ny + vp_z * nz);
198 template <
typename Po
intInT,
typename Po
intOutT>
202 typedef boost::shared_ptr<NormalEstimation<PointInT, PointOutT> >
Ptr;
203 typedef boost::shared_ptr<const NormalEstimation<PointInT, PointOutT> >
ConstPtr;
243 Eigen::Vector4f &plane_parameters,
float &curvature)
245 if (indices.size () < 3 ||
248 plane_parameters.setConstant (std::numeric_limits<float>::quiet_NaN ());
249 curvature = std::numeric_limits<float>::quiet_NaN ();
272 float &nx,
float &ny,
float &nz,
float &curvature)
274 if (indices.size () < 3 ||
277 nx = ny = nz = curvature = std::numeric_limits<float>::quiet_NaN ();
376 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
380 #ifdef PCL_NO_PRECOMPILE 381 #include <pcl/features/impl/normal_3d.hpp> 384 #endif //#ifndef PCL_NORMAL_3D_H_ boost::shared_ptr< NormalEstimation< PointInT, PointOutT > > Ptr
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
PointCloud::ConstPtr PointCloudConstPtr
bool computePointNormal(const pcl::PointCloud< PointInT > &cloud, const std::vector< int > &indices, Eigen::Vector4f &plane_parameters, float &curvature)
Compute the Least-Squares plane fit for a given set of points, using their indices, and return the estimated plane parameters together with the surface curvature.
bool computePointNormal(const pcl::PointCloud< PointInT > &cloud, const std::vector< int > &indices, float &nx, float &ny, float &nz, float &curvature)
Compute the Least-Squares plane fit for a given set of points, using their indices, and return the estimated plane parameters together with the surface curvature.
void setViewPoint(float vpx, float vpy, float vpz)
Set the viewpoint.
struct pcl::PointXYZIEdge EIGEN_ALIGN16
Feature< PointInT, PointOutT >::PointCloudConstPtr PointCloudConstPtr
virtual ~NormalEstimation()
Empty destructor.
unsigned int computeMeanAndCovarianceMatrix(const pcl::PointCloud< PointT > &cloud, Eigen::Matrix< Scalar, 3, 3 > &covariance_matrix, Eigen::Matrix< Scalar, 4, 1 > ¢roid)
Compute the normalized 3x3 covariance matrix and the centroid of a given set of points in a single lo...
std::string feature_name_
The feature name.
void solvePlaneParameters(const Eigen::Matrix3f &covariance_matrix, const Eigen::Vector4f &point, Eigen::Vector4f &plane_parameters, float &curvature)
Solve the eigenvalues and eigenvectors of a given 3x3 covariance matrix, and estimate the least-squar...
NormalEstimation estimates local surface properties (surface normals and curvatures)at each 3D point...
bool computePointNormal(const pcl::PointCloud< PointT > &cloud, Eigen::Vector4f &plane_parameters, float &curvature)
Compute the Least-Squares plane fit for a given set of points, and return the estimated plane paramet...
void flipNormalTowardsViewpoint(const PointT &point, float vp_x, float vp_y, float vp_z, Eigen::Matrix< Scalar, 4, 1 > &normal)
Flip (in place) the estimated normal of a point towards a given viewpoint.
Eigen::Vector4f xyz_centroid_
16-bytes aligned placeholder for the XYZ centroid of a surface patch.
NormalEstimation()
Empty constructor.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
EIGEN_ALIGN16 Eigen::Matrix3f covariance_matrix_
Placeholder for the 3x3 covariance matrix at each surface patch.
boost::shared_ptr< const NormalEstimation< PointInT, PointOutT > > ConstPtr
bool use_sensor_origin_
whether the sensor origin of the input cloud or a user given viewpoint should be used.
void computeFeature(PointCloudOut &output)
Estimate normals for all points given in <setInputCloud (), setIndices ()> using the surface in setSe...
PointCloudConstPtr input_
The input point cloud dataset.
Feature represents the base feature class.
A point structure representing Euclidean xyz coordinates, and the RGB color.
void getViewPoint(float &vpx, float &vpy, float &vpz)
Get the viewpoint.
float vpx_
Values describing the viewpoint ("pinhole" camera model assumed).
void useSensorOriginAsViewPoint()
sets whether the sensor origin or a user given viewpoint should be used.