don't filter point cloud when estimating normals to avoid mismatch of number of points and normals

This commit is contained in:
wmayer
2017-08-24 13:05:21 +02:00
parent 51c776fec5
commit e96189c110
2 changed files with 20 additions and 2 deletions

View File

@@ -179,6 +179,7 @@ void NormalEstimation::perform(std::vector<Base::Vector3d>& normals)
cloud->width = int (cloud->points.size ());
cloud->height = 1;
#if 0
// Build a passthrough filter to remove spurious NaNs
pcl::PointCloud<PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<PointXYZ>);
pcl::PassThrough<PointXYZ> pass;
@@ -186,13 +187,15 @@ void NormalEstimation::perform(std::vector<Base::Vector3d>& normals)
pass.setFilterFieldName ("z");
pass.setFilterLimits (0, 1.5);
pass.filter (*cloud_filtered);
#endif
// Estimate point normals
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);
pcl::search::KdTree<PointXYZ>::Ptr tree (new pcl::search::KdTree<PointXYZ> ());
pcl::NormalEstimation<PointXYZ, pcl::Normal> ne;
ne.setSearchMethod (tree);
ne.setInputCloud (cloud_filtered);
//ne.setInputCloud (cloud_filtered);
ne.setInputCloud (cloud);
if (kSearch > 0)
ne.setKSearch (kSearch);
if (searchRadius > 0)