简体   繁体   English

通过透视变换矩阵求变换角度

[英]find the angle of transformation through perspective transform matrix

I have got a 3*3 matrix after applying perspective transform function, i want to find out the angle of rotation through transform matrix.在应用透视变换 function 后,我得到了一个 3*3 矩阵,我想通过变换矩阵找出旋转角度。 I got this 3*3 matrix:我得到了这个 3*3 矩阵:

[[ 3.89007777e+00 -9.00480966e-02 -9.29332376e+02]
 [-3.47394211e-01  3.27758886e+00 -3.55127508e+02]
 [ 1.33714080e-03 -4.37819257e-04  1.00000000e+00]]

Suggest me a path by which i can find the angles in all three direction.建议我一条路径,通过它我可以找到所有三个方向的角度。

If you have matrix named rqmtx:如果您有名为 rqmtx 的矩阵:

phi = math.atan2(rqmtx[2][1], rqmtx[2][2])
psi = math.atan2(rqmtx[1][0], rqmtx[0][0])

if math.cos(psi) == 0:
    thetaa = math.atan2(-rqmtx[2][0], (rqmtx[1][0]/math.sin(psi)))
else:
    thetaa = math.atan2(-rqmtx[2][0], (rqmtx[0][0]/math.cos(psi)))
    
s = math.atan2(rqmtx[0][0], -math.sqrt(rqmtx[2][1]*rqmtx[2][1] + rqmtx[2][2]*rqmtx[2][2]))

pi = 22/7

phid = phi*(180/pi)
thetaad = thetaa*(180/pi)
psid = psi*(180/pi)

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

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