Python从两组点得到变换矩阵

2024-06-11 20:43:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我要图像,一个模拟,一个真实的数据,有亮点。在

模拟: Simulation

现实: reality

我能很好地探测到这些斑点并得到坐标。现在我需要计算两个坐标系之间的变换矩阵(比例,旋转,平移,也许是剪切)。如果需要的话,我可以手工选取(5-10)个对应的点给算法

我已经尝试了很多方法,包括: 2 ICP的实施: https://engineering.purdue.edu/kak/distICP/ICP-2.0.html#ICP

https://github.com/KojiKobayashi/iterative_closest_point_2d

实现仿射变换: https://math.stackexchange.com/questions/222113/given-3-points-of-a-rigid-body-in-space-how-do-i-find-the-corresponding-orienta/222170#222170

仿射变换的实现: Determining a homogeneous affine transformation matrix from six points in 3D using Python

how to perform coordinates affine transformation using python? part 2

他们中的大多数都是这样失败的: enter image description here 红点是从模拟转换到现实坐标系的点。在

到目前为止,最好的方法是这个how to perform coordinates affine transformation using python? part 2产生以下结果: enter image description here

如您所见,缩放和平移主要起作用,但图像仍需要旋转/镜像。在

关于如何得到一个有效的算法有什么想法吗?如果有必要,我可以提供我当前的非工作实现,但它们基本上是链接的。在


Tags: to方法inhttps图像com算法points
1条回答
网友
1楼 · 发布于 2024-06-11 20:43:14

我发现了错误。在

我使用plt.imshow来显示模拟图像和真实图像,然后从中选择参考点来计算转换。在

结果,由于通常的数组到图像索引翻转voodoo(或者我对转换的错误理解),我需要从模拟图像中切换参考点的x和y索引。在

有了这个,使用这个how to perform coordinates affine transformation using python? part 2一切都很好

相关问题 更多 >