I work on the Perspective-n-Point problem. From 4 img points in img CS (2D) and 4 corresponding points in world CS (3D, XYZ), I want to get the rotation and translation of the camera. In fact, opencv function cv2.solvePnP() solves that problem for me. It returns rotation as rotation vector [3x1] and translation vector.

I would like to ask for help with interpreting the rotation vector.

As far as I understand the rotation vector representation:

  • the rotation vector is the axis of the rotation
  • the length of rotation vector is the rotation angle θ in radians [around axis, which is rotation vector]

Lets' say the function returns rotation vector rvec as below: $$rvec = [-1.5147142; 0.11365167; 0.10590861]]$$


$$\theta_{rvec} = sqrt(-1.5147142^2 + 0.11365167^2 + 0.10590861^2) [rad] = 1.52266 [rad] = \frac{1.52266*180}{3.14} [deg] = 87.286 [deg]$$

1. Does three rvec components (-1.5147142; 0.11365167; 0.10590861) correspond to world coordinates? 2. Can I interpret the vector components as separate rotation angles in radians around components directions?

My rvec components interpretation:

$$\alpha_X = -1.5147142 [rad] = \frac{-1.5147*180}{3.14} [deg] = -86.83 [deg]$$

$$\beta_Y = 0.11365167 [rad] = \frac{0.11365167*180}{3.14} [deg] = 6.52 [deg]$$

$$\gamma_Z = 0.10590861 [rad] = \frac{0.10590861*180}{3.14} [deg] = 6.07 [deg]$$

$\alpha_X$ - angle around X (direction of first component)

$\beta_X$ - angle around Y (direction of second component)

$\gamma_X$- angle around Z (direction of third component)

My usecase: I have coordinates of four image points. I know the coordinates of these points in the real world. I know camera intrinsic matrix. I use PnP3 to get rotation and translation vector. From rotation matrix, I would like to find out what are the angles around fixed global/world axes: X, Y, Z. I am NOT interested in Euler angles. I want to find out how an object is being rotated around the fixed world coordinates (not it's own coordinate system).

I would really appreciate your help. I feel lost in rotation. Thank you in advance.

  • $\begingroup$ You could start by reading the documentation for cv2.solvePnP, which, if you follow the links in it, explains how to interpret the rotation vector. $\endgroup$ – amd Aug 26 '18 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.