XiaXuehai
XiaXuehai

Reputation: 610

What's the mean of the rotation vector which got from solvePnP in opencv?

I want use the function solvepnpto compute the Euler angle,and I got rvec .It's the rotation vector.what is it mean?

Using Rodrigues() can get the rotation matrix.How can I get the the pitch,yaw,and roll directly from rvec?

Upvotes: 0

Views: 3320

Answers (1)

Catree
Catree

Reputation: 2517

This image illustrates the rotation vector representation: the vector part represents a direction and the angle part is the amount on which you want to rotate around the vector/direction: By DF Malan (Own work) [Public domain], via Wikimedia Commons By DF Malan (Own work) [Public domain], via Wikimedia Commons

First, you have to keep in mind that there is a loss of freedom with Euler angles representation that could lead to gimbal lock. This is not the case with rotation matrix or rotation vector representation.

Then, you have to choose a convention (z-y-x, x-y-z, ...) for Euler angles.

Finally, based on the rotation order you have chosen, you have to extract the Euler angles from the rotation matrix, here you have the corresponding equations for a specific convention. You will see that some rotation matrix forms will produce ambiguities (multiple or infinite possible values for some part of the Euler angles).

Here you can find the conversion rotation matrix to Euler angles for the convention the author have chosen in OpenCV (here the tutorial from which the code comes from).

Upvotes: 1

Related Questions