0
votes

I've been experimenting with several registration methods in pcl. My problem with most of them is the initial alignment. So, I started studying more about how the point correspondences are found. With what I read in mind, I found some good parameter values for feature computation and matching that lead to perfect matches between the point clouds that I specifically use. I can see that they are correct since I know the result I'm expecting.

Now, having these correct correspondences, how can I run the ICP or any other registration algorithm having these correspondences as an initial condition?

I tried setting the correspondences_ member of pcl::IterativeClosestPoint to the correspondences I found but it looks like it doesn't get considered. I suppose it's just updated when align is executed.

I also came across some TransformationEstimation classes in the pcl documentation but I'm not good enough to even understand how to define these from a documentation (in case they are the way to go here). For example I tried this:

pcl::Correspondences correspondences;
//... Filling the correspondences
//
Eigen::Matrix4f finalTransform;
pcl::registration::TransformationEstimationSVD<pcl::PointCloud<pcl::PointXYZ>, pcl::PointCloud<pcl::PointXYZ>,pcl::Correspondences> aman;
aman.estimateRigidTransformation(*samplesChosenSource, *samplesChosenTarget,correspondences,finalTransform);

The first 2 parameters are the point clouds including only the points that I managed to match in the previous step.

Here is the documentation of the class. And here is the error popping up:
enter image description here

As, I said I'm not trying to specifically use this class. I just want to achieve what I explained above. However, an explanation of why the above class doesn't work would help me with using other classes in the library. This one is just an example. I tried to use a lot that seemed helpful but I couldn't define any of them.

1

1 Answers

0
votes

The "Initial Alignment" step (actually any Alignment) computes the rotation matrix, which you can get with getFinalTransformation of the pcl::Registration abstract class. So, assuming, for example, that you use SampleConsensusPrerejective:

pcl::SampleConsensusPrerejective<pcl::PointXYZ, pcl::PointXYZ, pcl::FPFHSignature33> sac_pr_ia;
...
sac_pr_ia.align(ia_cloud);
Eigen:Matrix4F ia_transform = sac_pr_ia.getFinalTransformation();

And than use with ICP as the "guess":

pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
...
icp.align(fine_cloud, ia_transform );