Principle Curvature Error [closed]
I am trying to calculate Principle curvatures and directions as well. Unfortunately, it gave error. I am dealing with more than 30000 points.Here is my sample points, program output, and code. Your suggestion most welcome. Thnx in advance.
Input:
-0.178011 -0.132448 0
-0.023969 -0.087338 0
........... ........... ..
........... ........... ..
Output:
0 0 1 3.02923e-029 0
-1.#IND -1.#IND -1.#IND 0 0
........... ........... ..
........... ........... ..
Code:
int main (...)
{
///Load Point cloud
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
ne.setInputCloud (cloud.makeShared());
pcl::search::KdTree<pcl::PointXYZ>::Ptr cloud_normal_tree (new pcl::search::KdTree<pcl::PointXYZ>());
ne.setSearchMethod (cloud_normal_tree);
// Output datasets
pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>);
int k=15;
ne.setKSearch (k);
ne.compute (*normals);
pcl::PrincipalCurvaturesEstimation<pcl::PointXYZ, pcl::Normal, pcl::PrincipalCurvatures> pc;
pc.setInputCloud (cloud.makeShared());
pc.setInputNormals (normals);
pcl::search::KdTree<pcl::PointXYZ>::Ptr pc_tree (new pcl::search::KdTree<pcl::PointXYZ> ());
pc.setSearchMethod (pc_tree);
int kk=15;
pc.setKSearch(kk);
pcl::PointCloud<pcl::PrincipalCurvatures>::Ptr pc_output (new pcl::PointCloud<pcl::PrincipalCurvatures> ());
pc.compute (*pc_output);
cout<<pc_output->points.size()<<endl;
for (i = 0; i <pc_output->points.size(); ++i)
std::cerr << " " << pc_output->points[i].principal_curvature_x << " " << pc_output->points[i].principal_curvature_y << " " << pc_output->points[i].principal_curvature_z << " " << pc_output->points[i].pc1 << " " << pc_output->points[i].pc2 << std::endl;
}