1
votes

I am working on downsampling point cloud and normal estimation. The normal estimation is working fine with me and downsampling also; however, when they combined together they are not working, and I receive this: (core dumped). below is my code. Any help is appreciated?

pcl::PCLPointCloud2 pcl_pc2;
pcl::PointCloud<pcl::PointXYZ>::Ptr temp_cloud2(new    pcl::PointCloud<pcl::PointXYZ>);

pcl_conversions::toPCL(*input,pcl_pc2);

pcl::PointCloud<pcl::PointXYZ>::Ptr temp_cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::fromPCLPointCloud2(pcl_pc2,*temp_cloud);

// Perform the actual filtering
pcl::VoxelGrid<pcl::PointXYZ> sor;
sor.setInputCloud (temp_cloud);
sor.setLeafSize (0.1f, 0.1f, 0.1f);
sor.filter (*temp_cloud2); 

//do stuff with temp_cloud here
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
ne.setInputCloud (temp_cloud2);

// Create an empty kdtree representation, and pass it to the normal estimation object.
// Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
ne.setSearchMethod (tree);

// Output datasets
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);

// Use all neighbors in a sphere of radius 3cm
ne.setRadiusSearch (0.03);

// Compute the features
ne.compute (*cloud_normals);
1

1 Answers

1
votes

It's solved for me; I have changed the searching radius from 0.03 to 0.3 because at 0.03 there were no point cloud data due to the downsampling.