Computing attitude(roll, pitch & yaw) from solvePnP()
I am using solvePnP() to compute for attitude(roll, pitch & yaw). From solvePnP() I got the rotation vector and I use this to accordingly get roll, pitch and yaw. But the problem is when I rotate the camera 45deg, the measurement gives 25deg.
I think, it might be that I need to integrate the angle value(each roll, pitch & yaw ) over time..am I right, integrating it will resolve the issue?
Thanks in advance.
EDIT
The code snippet:
pose[3] = -rot_vec.at(0);
pose[4] = -rot_vec.at(1);
pose[5] = -rot_vec.at(2);
Note: pose[] is roll, pitch & yaw respectively & rot_vec is raw value of rotation vector obtained from solvePnP()
You should check if there is either a constant error on your measurements, like always 20 degrees, or if it only applies to the single angle. Also, without sharing code with people on how you calculate it, it is actually quite difficult to say what went wrong :)
@StevenPuttemans: Thanks for the information. I've appended the code snippet in the question.
The output given by solvePnP is the axis-rotation values for the orientation, not eulerangles. They are three elements because opencv uses the reduced notation, being three values to define the rotation axis, and the module of the resultant vector to define the rotation value.