如何从旋转矩阵计算角度 [英] How to calculate the angle from rotation matrix

查看:1034
本文介绍了如何从旋转矩阵计算角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用单个对象的两个图像,该对象从其第一个图像旋转了一定程度.

I am using two image of the single object the object is roated certain degree from its first image.

我已经计算出每个图像的位姿,并使用Rodergues()将旋转矢量转换为Matrix.现在如何计算并查看其从第一个位置旋转了多少?

I have calculated the POSE of each image and converted the rotational vector to Matrix using Rodergues(). Now how do I calculate and see how much it is rotated from its first position?

我尝试了很多方法,但是答案都还不是很接近

I have tried many ways but answers was no were close

我的相机是固定的,只有物体在移动.

My camera is fixed only the object is moving.

推荐答案

我们可以使用以下公式从旋转矩阵中获得欧拉角.

We can get Euler angles from rotation matrix using following formula.

给出3×3旋转矩阵

3个欧拉角是

这里atan2是相同的反正切函数,具有象限检查功能,通常可以在C或Matlab中找到.

Here atan2 is the same arc tangent function, with quadrant checking, you typically find in C or Matlab.

注意:如果围绕y轴的角度正好为+/- 90°,则必须小心.在这种情况下,第一列和最后一行中的所有元素(下角的元素为1或-1)除外(0(cos(1)= 0)).一种解决方案是将围绕x轴的旋转固定为180°,并根据以下公式计算围绕z轴的角度:atan2(r_12,-r_22).

Note: Care must be taken if the angle around the y-axis is exactly +/-90°. In that case all elements in the first column and last row, except the one in the lower corner, which is either 1 or -1, will be 0 (cos(1)=0). One solution would be to fix the rotation around the x-axis at 180° and compute the angle around the z-axis from: atan2(r_12, -r_22).

另请参见 https://www.geometrictools.com/Documentation/EulerAngles.pdf,其中包括六个不同阶数的欧拉角的实现.

See also https://www.geometrictools.com/Documentation/EulerAngles.pdf, which includes implementations for six different orders of Euler angles.

这篇关于如何从旋转矩阵计算角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆