我尝试使用icp算法显示对齐的rgb点云。但在点云对齐期间,它会抛出“无效的分配大小错误”。
我的代码:
pcl::PointCloud<pcl::PointXYZRGB>::Ptr PassingCloudstoICP( pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointCloud1, pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointCloud2)
{
pcl::IterativeClosestPoint<pcl::PointXYZRGB, pcl::PointXYZRGB> icp;
icp.setInputCloud (pointCloud1);
icp.setInputTarget (pointCloud2);
// 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 (25);
// 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(*finalcloud);
return finalcloud;
}
我已经尝试调试它并完成代码演练,当icp.align(* finalcloud)执行时,它转到以下文件registration.hpp,这里通过以下方式 功能。
--- pcl::Registration<PointSource, PointTarget, Scalar>::align (PointCloudSource &output, const Matrix4& guess)"
--- "initcompute()"
---- "setInputCloud(target_)" -- when this line executes the compiler throws "Invalid allocation size 4294967295 bytes"
请建议我如何解决此错误。
感谢任何帮助。