0

When i get my rvecs from the function estimatePoseSingleMarkers how can I get the angle for the orientation of my marker ?

On Stackoverflow and others forums, the function Rodrigues seems to be necessary, but I don't understand what exactly the function does.

After apply this function, I understood that I need to convert the result of the function Rodrigues into a euler angles.

I expect to have a float vector representing an angle like 45.6 ° for example. But I have strange values: 1.68175 -0.133805 -1.5824 For this values, I put my marker in front of my camera so the values does not correspond.

Here my code :

cv::Mat R;
cv::Rodrigues(rvecs[i], R); // R is 3x3

std::vector<float> v = rotationMatrixToEulerAngles(R);
for(size_t i = 0; i < v.size(); i ++)
     std::cout << v[i] << std::endl;

The function rotationMatrixToEulerAngles is from : https://learnopencv.com/rotation-matrix-to-euler-angles, I try others things but I still have strange values, so I don't get it something... I want to have something like [180, 90 ,0] or [45,0,152] etc.

If someone can explain me by steps how from the rvecs I can get a vector of angles (on angle for each axe).

UPDATE :

I test many differents code propose in internet, I read article but I havn't good values. I got now "good" float values like 190.45 or 80.32 etc. because I multiply by (180/M_PI) but the values are wrong.

When I put my marker in front of my camera, I should have [0 , 0, 0] I think, but I havn't that. What is the problem ?

AmBou99
  • 1
  • 1

1 Answers1

0

I found the problem : I need to put rvecs[i][0] [i][1] [i][2] in a vector and then use cv::Rodrigues with this vector and use the function rotationMatrixToEuleurAngles

AmBou99
  • 1
  • 1