在OpenCV中从旋转矩阵和平移矢量获取旋转轴 [英] Obtain Rotation Axis from Rotation Matrix and translation vector in OpenCV
问题描述
我有两个图像的棋盘,它们有一定的旋转角度.让我们以第一张图片为参考找到第二张图片的旋转角度.
I have a chessboard in two images with some angle of rotation. Lets find the rotation angle of second image with reference of first image.
为此,我找到了这些对象的旋转矩阵(3x3)和平移矩阵(3x1).
For that I found the Rotation Matrix (3x3) and translation matrix (3x1) of those objects.
如何使用这些矩阵找到对象的旋转角度和旋转轴?
How can I find the Rotation Angle and Rotation Axis of object using those matrices?
推荐答案
For every type of conversion between rotation representations you have this website euclidean space.
您将找到以下方面的理论和代码示例:
You will find theory and code samples of:
-
四元数的旋转矩阵:链接
四元数到轴角:链接
一般的轮换和所有表示形式:链接
Rotations in general and all representations: link
关于您的问题,您有轴角度".如果您具有旋转矩阵R(3x3),则可以通过这种方式获得角度和轴(请参见
And in relation to your question you have Axis Angle. If you have the rotation matrix R (3x3), you can obtain the angle and axis this way (see Matrix to Axis Angle):
-
angle = acos(( R00 + R11 + R22 - 1)/2);
x,y,x轴:
x =(R21-R12)/sqrt((R21-R12)^ 2 +(R02-R20)^ 2 +(R10-R01)^ 2);
x = (R21 - R12)/sqrt((R21 - R12)^2+(R02 - R20)^2+(R10 - R01)^2);
y =(R02-R20)/sqrt((R21-R12)^ 2 +(R02-R20)^ 2 +(R10-R01)^ 2);
y = (R02 - R20)/sqrt((R21 - R12)^2+(R02 - R20)^2+(R10 - R01)^2);
z =(R10-R01)/sqrt((R21-R12)^ 2 +(R02-R20)^ 2 +(R10-R01)^ 2);
z = (R10 - R01)/sqrt((R21 - R12)^2+(R02 - R20)^2+(R10 - R01)^2);
这篇关于在OpenCV中从旋转矩阵和平移矢量获取旋转轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!