PCL 1.8.1 ICP 点到点配准算法代码示例:斯坦福雕像点云配准
#include
int main(int argc, char** argv) { // Load input point clouds pcl::PointCloudpcl::PointXYZ::Ptr cloud1 (new pcl::PointCloudpcl::PointXYZ); pcl::PointCloudpcl::PointXYZ::Ptr cloud2 (new pcl::PointCloudpcl::PointXYZ); if (pcl::io::loadPCDFilepcl::PointXYZ (argv[1], cloud1) == -1) // load the file { PCL_ERROR ("Couldn't read file %s \n", argv[1]); return (-1); } if (pcl::io::loadPCDFilepcl::PointXYZ (argv[2], cloud2) == -1) // load the file { PCL_ERROR ("Couldn't read file %s \n", argv[2]); return (-1); }
// Perform ICP registration
pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
icp.setInputCloud(cloud1);
icp.setInputTarget(cloud2);
pcl::PointCloud<pcl::PointXYZ> aligned;
icp.align(aligned);
// Save output point cloud
pcl::io::savePCDFileASCII(argv[3], aligned);
std::cerr << "Saved " << aligned.points.size() << " data points to " << argv[3] << std::endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/oZ0e 著作权归作者所有。请勿转载和采集!