首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PCL迭代最近点和其他报告空点云的效果

问PCL迭代最近点和其他报告空点云的效果
EN

Stack Overflow用户
提问于 2018-12-10 21:00:58
回答 1查看 1.4K关注 0票数 0

我正在使用PCL与预构建版本(Windows的1.9.1),甚至与源代码构建的PCL,但我无法使用迭代最近点(ICP)或甚至其他过滤器(例如,正常估计)来正常工作。下面是我的c++代码:

代码语言:javascript
复制
#include <pcl/io/ply_io.h>
#include <pcl/registration/icp.h>

void test(void) 
{ 
        typedef pcl::PointXYZ              PointType; 
        typedef pcl::PointCloud<PointType> PointCloudType;

        typedef pcl::IterativeClosestPoint<PointType, PointType, float> ICPType; 

        PointCloudType::Ptr pcA(new PointCloudType()); 
        pcl::io::loadPLYFile("pointcloud00000.ply", *pcA); 
        std::cout << "pcA size: " << pcA->points.size() << std::endl; 

        PointCloudType::Ptr pcB(new PointCloudType()); 
        pcl::io::loadPLYFile("pointcloud00001.ply", *pcB); 
        std::cout << "pcB size: " << pcB->points.size() << std::endl; 

        ICPType icp; 
        icp.setInputSource(pcA); 
        icp.setInputTarget(pcB); 

        PointCloudType pcC; 
        icp.align(pcC); 
        std::cout << "pcC size: " << pcC.points.size() << std::endl; 
} 

这是我在输出控制台中得到的结果:

代码语言:javascript
复制
pcA size: 19346 
pcB size: 19409 
[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud! 
[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud! 
[pcl::IterativeClosestPoint::computeTransformation] Not enough correspondences found. Relax your threshold parameters. 
pcC size: 19346 

使用云有一些问题,PCL抱怨他们的空洞,但他们已经被填满了,正如它所写的,大约有20K点。

你能帮帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2018-12-11 06:43:32

您可能需要提供一些参数才能使算法正常工作。

看一看API文档,您可以看到有一个示例提供了如何使用该算法。

代码语言:javascript
复制
IterativeClosestPoint<PointXYZ, PointXYZ> icp;
// Set the input source and target
icp.setInputCloud (cloud_source);
icp.setInputTarget (cloud_target);
// Set the max correspondence distance to 5cm (e.g., correspondences with higher distances will be ignored)
icp.setMaxCorrespondenceDistance (0.05);
// Set the maximum number of iterations (criterion 1)
icp.setMaximumIterations (50);
// Set the transformation epsilon (criterion 2)
icp.setTransformationEpsilon (1e-8);
// Set the euclidean distance difference epsilon (criterion 3)
icp.setEuclideanFitnessEpsilon (1);
// Perform the alignment
icp.align (cloud_source_registered);
// Obtain the transformation that aligned cloud_source to cloud_source_registered
Eigen::Matrix4f transformation = icp.getFinalTransformation ();

为了获得好的结果,你必须根据你的数据集调整参数。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53706240

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档