Fan*_*Fox 3 c++ point-cloud-library
我使用pcl的实现iterative closest point。我希望能够使用我使用的任何注册方法的内点。
该registration班有能力输出时对齐功能被称为对准云:
icp_.align(outcloud, guess);
Run Code Online (Sandbox Code Playgroud)
而PCLBase类具有以下功能:
indices = icp_.getIndices();
Run Code Online (Sandbox Code Playgroud)
不幸的是getIndices只返回整个云的索引。我已经在云上测试过,被距离对应拒绝的异常值(或内部值)似乎无法检索?
我查了一下,云中有一些应该被拒绝的点,见下文:

建立在 DJDuff 的回答基础上,这是获得相应点的一种方法,尽管它涉及违反课程。这个继承自 IterativeClosestPointNonLinear 类,可以作为替代品。对于我的用例,我只是将它放在任何我想使用 IterativeClosestPointNonLinear 并且能够访问correspondences_成员的地方。类似的方法可用于任何其他注册接口。
/** \brief This is a mock class with the sole purpose of accessing a protected member of a class it inherits from.
*
* Some of the relevant documentation for correspondences: http://docs.pointclouds.org/trunk/correspondence_8h_source.html#l00092
*/
template <typename PointSource, typename PointTarget, typename Scalar = float>
class IterativeClosestPointNonLinear_Exposed : public pcl::IterativeClosestPointNonLinear<PointSource, PointTarget, Scalar> {
public:
pcl::CorrespondencesPtr getCorrespondencesPtr() {
for (uint32_t i = 0; i < this->correspondences_->size(); i++) {
pcl::Correspondence currentCorrespondence = (*this->correspondences_)[i];
std::cout << "Index of the source point: " << currentCorrespondence.index_query << std::endl;
std::cout << "Index of the matching target point: " << currentCorrespondence.index_match << std::endl;
std::cout << "Distance between the corresponding points: " << currentCorrespondence.distance << std::endl;
std::cout << "Weight of the confidence in the correspondence: " << currentCorrespondence.weight << std::endl;
}
return this->correspondences_;
}
};
Run Code Online (Sandbox Code Playgroud)
下面是在以这种方式获得的两个点云之间的对应点之间绘制的一些线。值得注意的是,pcl::Correspondence.distance两点之间的值似乎并不总是严格小于注册方法的值maxCorrespondenceDistance,因此您可能必须检查距离以确保您只获得您想要的对应关系。