问题描述
我使用solvePnP,我得到一个翻译向量。
现在我需要比较一些欧拉角度与solvePnP的结果。
我想/需要将欧拉角转换成rodrigues;
I am useing solvePnP and i am getting a translation vector. Now i need to compare some euler angles with those results from solvePnP.And i want/need to transfer the euler angles into "rodrigues";
来自solvePnP的平移矢量等于欧拉角。
翻译矩阵是唯一与罗德里格斯有什么关系吗?
或有特殊的rodrigues角度,总共不同于3欧拉角度?
两者之间的数学如何?
有没有我找不到的OpenCV功能?
Is the translation vector from solvePnP equal to euler angles. Is the translation matrix the only thing what has to do with Rodrigues? or are there special rodrigues angles which are totaly different to the 3 euler angles?How is the math between both? Is there an OpenCV function which i couldn't find?
推荐答案
首先,忘记翻译向量,因为它与 / strong>:翻译移动东西,旋转改变它们的方向。
First, forget about translation vector, because it is not related with rotation: translation moves things around, rotation changes their orientation.
Rodrigues参数也称为。它们由4个数字 [theta,x,y,z]
形成,这意味着您必须围绕由单位矢量<$描述的轴旋转角度theta c $ c> v = [x,y,z] 。
查看函数参考,似乎OpenCV使用Rodrigues符号的紧凑表示法作为具有3个元素的向量 rod2 = [a,b,c]
,其中:
Rodrigues parameters are also called axis-angle rotation. They are formed by 4 numbers [theta, x, y, z]
, which means that you have to rotate an angle "theta" around the axis described by unit vector v=[x, y, z]
.Looking at cv::Rodrigues function reference, it seems that OpenCV uses a "compact" representation of Rodrigues notation as vector with 3 elements rod2=[a, b, c]
, where:
- 旋转角度
theta
是输入向量的模块theta = sqrt(a ^ 2 + b ^ 2 + c ^ 2)
- 旋转轴
v
是标准化输入向量:v = rod2 / theta = [a / theta,b / theta,c / theta]
- Angle to rotate
theta
is the module of input vectortheta = sqrt(a^2 + b^2 + c^2)
- Rotation axis
v
is the normalized input vector:v = rod2/theta = [a/theta, b/theta, c/theta]
因此,来自solvePnP的Rodrigues矢量与甚至没有什么相关符号,表示围绕X,Y和Z轴组合的三个连续旋转。
So, Rodrigues vector from solvePnP is not even slightly related with Euler angles notation, which represent three consecutive rotations around a combination of X, Y and Z axes.
如何比较两个旋转?这是一个好问题。欧拉和罗德里格斯都有奇点和其他问题。例如,如果你比较两个欧拉燕鸥或两个罗德里格斯参数,他们可以看起来完全不同,但实际上代表几乎相同的旋转。
如果你只需要检查两个旋转是否相同(或大约),你可以按照下面的方法:
How to compare both rotations? This is a good question. Both Euler- and Rodrigues- representations have singularities and other problems. For instance, if you compare two Euler terns, or two Rodrigues parameters, they can look completely different but actually represent almost the same rotation.If you just need to check if both rotations are the same (or approx.), you can follow the next approach:
- 将两个旋转变换为矩阵符号(四元数也有效)
- OpenCV Rodrigues向量可以使用函数
- 为了将Euler转换为矩阵,我建议您查看
- Transform both rotations to matrix notation (quaternions are also valid)
- OpenCV Rodrigues vector can be transformed to matrix using cv::Rodrigues function
- For transforming Euler to matrix, I suggest you to take a look to conversions section of euclideanspace.com
- 使用旋转矩阵,乘以转置反向旋转)的另一个。空转是单位矩阵。
- 使用四元数,将一个乘以另一个的复共轭(取消最后三个分量)。
- 空旋转矩阵是身份。
- Null四元数在第一个组件中有1或-1。
这篇关于罗德里格斯变成欧拉角,反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!