i'm trying to use the icp algorithm to align 2 RGBD cloud, but the function align results in segmentation fault and i don't know why and how to fix this, if anyone can help-me i will be grateful
this is a example of what i'm trying to do.
pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
vector<int>index;
pcl::removeNaNFromPointCloud(*cloud_in,*cloud_in,index);
pcl::removeNaNFromPointCloud(*cloud_out,*cloud_out,index);
icp.setInputCloud(cloud_in);
icp.setInputTarget(cloud_out);
pcl::PointCloud<pcl::PointXYZ> Final;
icp.align(Final);
I had the same issue. In my case the input point cloud was an ordered point cloud (with resolution 48x64) and containing NaNs. Even though I applied pcl::removeNaNFromPointCloud, nan values were still there. I solved the problem by converting my ordered input point cloud to an unordered point cloud (Nx3) before processing.
If your cloud_in is an ordered point cloud too, try converting it to unordered first as following:
cloud_in->width = cloud_in->width * cloud_in->height;
cloud_in->height = 1;
cloud_in->is_dense = false;
cloud_in->points.resize (cloud_in->width * cloud_in->height);
// Then remove NaNs and apply ICP
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.