正常点的NaN值

问题描述 投票:1回答:1

我在验证法线点的坐标中包含的值时遇到问题。最初,我估计云的法线,当我检查法线的xyz坐标时,它将返回nan。

pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>);

// Object for normal estimation.
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> normalEstimation;
normalEstimation.setInputCloud(cloud);
// For every point, use all neighbors in a radius of 3cm.
normalEstimation.setRadiusSearch(0.03);
// A kd-tree is a data structure that makes searches efficient. More about it later.
// The normal estimation object will use it to find nearest neighbors.
pcl::search::KdTree<pcl::PointXYZ>::Ptr kdtree(new pcl::search::KdTree<pcl::PointXYZ>);
normalEstimation.setSearchMethod(kdtree);

// Calculate the normals.
normalEstimation.compute(*normals);

for (size_t i = 0; i < cloud->points.size(); i++){
  std::cout << "x: " << cloud->points[i].x <<std::endl;
  std::cout << "normal x: " << normals->points[i].normal_x <<std::endl; //-nan here
}

我该如何解决?

c++ computer-vision nan point-cloud-library normals
1个回答
0
投票

似乎就像您的输入点云有问题。确保您的点云不是平坦平面,并确保您没有重复点。使我不适的是搜索半径。也尝试与此玩。

我刚刚用非常相似的代码遇到了相似的问题。评论非常有帮助,谢谢。这可能为时已晚,但仍可能对某些人有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.