如何在Matlab中找到ICP变换中的相似对应点?

问题描述 投票:0回答:1

我有 2 组点云,并在 Matlab 中使用以下代码读取它们:

ptCloud1 = pcread('sub2a.ply');
ptCloud2 = pcread('sub2b.ply');

然后使用 icp(迭代最近点)算法将第二个与第一个注册,如下所示:

[tform,movingReg,rmse] = pcregrigid(ptCloud2,ptCloud1)

“movingReg”中的答案。 现在的问题是我如何知道'movingReg'的点云中的哪个点是'ptCloud1'的点云对应的相似点?

matlab matlab-cvst point-clouds
1个回答
0
投票

不知道matlab的ICP的具体实现。但最简单的情况是创建一个从目标到源的 KDTree,然后对每个点进行查询。我将给出一个 Python 通用代码,希望你也能在 Matlab 中使用它。

使用 scipy,

from scipy.spatial import KDTree

def find_correspondences(source_points, target_points):
    tree = KDTree(target_points)
    correspondences_index = []

    for point in source_points:
        _, idx = tree.query(point)
        target_point_index = idx
        correspondences_index.append(target_point_index)

    return correspondences_index

现在,

correspondences_index
列表保存了每个点之间的映射。基本上,对应索引[0]将给出源中第一个点的对应点。然后您可以为相应的目标点和源点添加相同的颜色以可视化它们。

© www.soinside.com 2019 - 2024. All rights reserved.