Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rodrigues into Eulerangles and vice versa

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";

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?

like image 778
user1651460 Avatar asked Oct 17 '12 11:10

user1651460


People also ask

How do you convert a rotation matrix to Euler angles?

Given a rotation matrix R, we can compute the Euler angles, ψ, θ, and φ by equating each element in R with the corresponding element in the matrix product Rz(φ)Ry(θ)Rx(ψ). This results in nine equations that can be used to find the Euler angles. Starting with R31, we find R31 = − sin θ.

What is a rotation vector?

A vector quantity whose magnitude is proportional to the amount or speed of a rotation, and whose direction is perpendicular to the plane of that rotation (following the right-hand rule). Spin vectors, for example, are rotation vectors.


1 Answers

First, forget about translation vector, because it is not related with rotation: translation moves things around, rotation changes their orientation.

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:

  • 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]

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:

  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
  2. "Subtract" one rotation from the other, that is concatenating one with the inverse of the other
    • Using rotation matrices, multiply one by the transpose (inverse rotation) of the other one. Null rotation is the identity matrix.
    • Using quaternions, multiply one by the complex conjugate of the other (negate the three last components).
  3. Check if the result is close to a null rotation:
    • Null rotation matrix is the identity.
    • Null quaternion has a 1 or a -1 in the first component
like image 69
dunadar Avatar answered Sep 28 '22 04:09

dunadar