Point Cloud Library (PCL)
1.9.1
|
41 #ifndef PCL_NORMAL_3D_H_
42 #define PCL_NORMAL_3D_H_
44 #include <pcl/features/feature.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);
202 template<
typename Po
intNT>
inline bool
204 std::vector<int>
const &normal_indices,
205 Eigen::Vector3f &normal)
207 Eigen::Vector3f normal_mean = Eigen::Vector3f::Zero ();
209 for (
size_t i = 0; i < normal_indices.size (); ++i)
211 const PointNT& cur_pt = normal_cloud[normal_indices[i]];
215 normal_mean += cur_pt.getNormalVector3fMap ();
219 if (normal_mean.isZero ())
222 normal_mean.normalize ();
224 if (normal.dot (normal_mean) < 0)
241 template <
typename Po
intInT,
typename Po
intOutT>
245 typedef boost::shared_ptr<NormalEstimation<PointInT, PointOutT> >
Ptr;
246 typedef boost::shared_ptr<const NormalEstimation<PointInT, PointOutT> >
ConstPtr;
286 Eigen::Vector4f &plane_parameters,
float &curvature)
288 if (indices.size () < 3 ||
291 plane_parameters.setConstant (std::numeric_limits<float>::quiet_NaN ());
292 curvature = std::numeric_limits<float>::quiet_NaN ();
315 float &nx,
float &ny,
float &nz,
float &curvature)
317 if (indices.size () < 3 ||
320 nx = ny = nz = curvature = std::numeric_limits<float>::quiet_NaN ();
419 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
423 #ifdef PCL_NO_PRECOMPILE
424 #include <pcl/features/impl/normal_3d.hpp>
427 #endif //#ifndef PCL_NORMAL_3D_H_
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...
This file defines compatibility wrappers for low level I/O functions.
NormalEstimation()
Empty constructor.
NormalEstimation estimates local surface properties (surface normals and curvatures)at each 3D point.
PointCloudConstPtr input_
The input point cloud dataset.
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
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,...
struct pcl::PointXYZIEdge EIGEN_ALIGN16
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...
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,...
boost::shared_ptr< const NormalEstimation< PointInT, PointOutT > > ConstPtr
void getViewPoint(float &vpx, float &vpy, float &vpz)
Get the viewpoint.
PointCloud represents the base class in PCL for storing collections of 3D points.
A point structure representing Euclidean xyz coordinates, and the RGB color.
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.
Feature< PointInT, PointOutT >::PointCloudConstPtr PointCloudConstPtr
virtual ~NormalEstimation()
Empty destructor.
boost::shared_ptr< NormalEstimation< PointInT, PointOutT > > Ptr
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
PointCloud::ConstPtr PointCloudConstPtr
float vpx_
Values describing the viewpoint ("pinhole" camera model assumed).
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...
void setViewPoint(float vpx, float vpy, float vpz)
Set the viewpoint.
EIGEN_ALIGN16 Eigen::Matrix3f covariance_matrix_
Placeholder for the 3x3 covariance matrix at each surface patch.
void useSensorOriginAsViewPoint()
sets whether the sensor origin or a user given viewpoint should be used.
bool flipNormalTowardsNormalsMean(pcl::PointCloud< PointNT > const &normal_cloud, std::vector< int > const &normal_indices, Eigen::Vector3f &normal)
Flip (in place) normal to get the same sign of the mean of the normals specified by normal_indices.
std::string feature_name_
The feature name.
Eigen::Vector4f xyz_centroid_
16-bytes aligned placeholder for the XYZ centroid of a surface patch.
Feature represents the base feature class.