c++point-cloud-librarypoint-cloudspcl

Align two Point Clouds with PCL only by translation


I am trying to align two point clouds. For this I use the Iterative Closest Point Algorithm (ICP) of the PCL library. This works quite well so far.

pcl::IterativeClosestPoint<PointT, PointT> icp; 
icp.setMaximumIterations(max_iterations);
icp.setMaxCorrespondenceDistance(max_correspondence_distance);
icp.setRANSACOutlierRejectionThreshold(outlier_rejection_threshold);
icp.setEuclideanFitnessEpsilon(euclidean_fitness_epsilon);
icp.setTransformationEpsilon(transformation_epsilon);
icp.setTransformationRotationEpsilon(transformation_rotation_epsilon);
icp.setInputSource(source); 
icp.setInputTarget(target); 
icp.align(*result);

However, my problem is that a rotation is determined for certain point clouds but none should exist.

Is there somehow a way to deactivate the rotation during fit?

I have not found anything helpful in the documentation so far:
[1] http://pointclouds.org/documentation/classpcl_1_1_iterative_closest_point.html
[2] http://pointclouds.org/documentation/classpcl_1_1_registration.html


Solution

  • One way to achieve this could be to use TransformationEstimationLM instead of the TransformationEstimationSVD that ICP uses by default, and create a custom WarpPointRigid class by adapting WarpPointRigid6D which estimates 6 transformation parameters (3 rotation and 3 translation). See also:
    TransformationEstimationLM::setWarpFunction
    icp.setTransformationEstimation