罗德里格斯到欧拉角,反之亦然

Rodrigues into Eulerangles and vice versa(罗德里格斯到欧拉角,反之亦然)

本文介绍了罗德里格斯到欧拉角,反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用solvePnP,我得到了一个平移向量.现在我需要将一些欧拉角与solvePnP的结果进行比较.我想/需要将欧拉角转换为罗德里格斯";

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 的平移向量是否等于欧拉角.翻译矩阵是唯一与罗德里格斯有关的东西吗?还是有与 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?

推荐答案

首先,忘记translation向量,因为它与rotation无关:translation move things around, 旋转会改变它们的方向.

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";围绕由单位向量 v=[x, y, z] 描述的轴.查看 cv::Rodrigues 函数参考,似乎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 vector theta = 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 向量与 Euler 甚至没有一点关系角度表示法,表示围绕 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.

如何比较两个旋转?这是一个很好的问题.Euler 和 Rodrigues 表示都有奇点和其他问题.例如,如果您比较两个欧拉燕鸥或两个罗德里格斯参数,它们可能看起来完全不同,但实际上表示几乎相同的旋转.如果您只需要检查两个旋转是否相同(或近似),您可以按照下一个方法:

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:

  1. 将两个旋转都转换为矩阵表示法(四元数也有效)
    • OpenCV Rodrigues 向量可以使用 cv:: 转换为矩阵罗德里格斯函数
    • 为了将欧拉转换为矩阵,我建议你看看 conversions 部分 来自 euclideanspace.com
  1. 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
  • 使用旋转矩阵,将一个矩阵乘以另一个矩阵的转置(反向旋转).空旋转是单位矩阵.
  • 使用四元数,将一个乘以另一个的复共轭(取反最后三个分量).
  • 空旋转矩阵是恒等式.
  • 空四元数在第一个组件中包含 1 或 -1

这篇关于罗德里格斯到欧拉角,反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:罗德里格斯到欧拉角,反之亦然

基础教程推荐