简体   繁体   English

来自两个向量的3D转换矩阵

[英]3D transformation matrix from two vectors

I have a pair of 3D points in two coordinates systems, and I need to find the transformation matrix (rotation, scale, translation) between the coordinates systems. 我在两个坐标系中有一对3D点,我需要找到坐标系之间的转换矩阵(旋转,缩放,平移)。

For example two points 例如两点
p0 = (x0,y0,z0) p0 =(x0,y0,z0)
p1 = (x1,y1,z1) p1 =(x1,y1,z1)

which correspond to points in another coordinates system: 对应于另一个坐标系中的点:
q0 = (x0', y0', z0') q0 =(x0',y0',z0')
q1 = (x1', y1', z1') q1 =(x1',y1',z1')

I need to find the transformation M (R|T) such that 我需要找到这样的变换M(R | T)
q0 = M * p0 q0 = M * p0
q1 = M * p1 q1 = M * p1

If there is an easy way to do it using opencv or python it would be terrific. 如果有使用opencv或python的简单方法,那就太好了。

We can interpret your problem in this way. 我们可以以此方式解释您的问题。 You want to find a matrix M such that 您想找到一个矩阵M使得

    for matrix P = [p1 p2] and Q = [q1 q2], Q = MP. 

We can then solve for M: 然后我们可以求解M:

    M = Q.dot(numpy.linalg.pinv(P))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM