Skip to content

Instantly share code, notes, and snippets.

@hfaulds
Created March 27, 2012 10:48
Show Gist options
  • Select an option

  • Save hfaulds/2214794 to your computer and use it in GitHub Desktop.

Select an option

Save hfaulds/2214794 to your computer and use it in GitHub Desktop.
ICP
PointCloud::ConstPtr alignedPointClouds()
{
PointCloud clouds_merged = *filterCloudByDepth(clouds[0]).get();
for(int i=1; i < NUM_CAPTURES; i++) {
if(clouds[i]) {
pcl::IterativeClosestPoint<pcl::PointXYZRGB, pcl::PointXYZRGB> icp;
icp.setMaxCorrespondenceDistance (0.5);
icp.setTransformationEpsilon (1e-5);
//icp.setEuclideanFitnessEpsilon (1);
icp.setInputCloud(filterCloudByDepth(clouds[i]));
icp.setInputTarget((new PointCloud(clouds_merged))->makeShared());
PointCloud cloud_aligned;
icp.align(cloud_aligned);
clouds_merged += cloud_aligned;
}
}
return clouds_merged.makeShared();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment