How to calculate the angle relative to the camera - python

Hi, I'm using python to write a head pose estimation program. I saw all the demos and other projects online but I couldn't understand how to find the angles of the pitch, yaw and roll, relative to the camera. I used to project 3 axes on a frame using cv2.drawFrameAxes function (so I do have the vectors and camera calibration) but I need to get an angle (0 degrees, 15, 45, etc).

Thank you for your help and time, Anthon.

Update: I've posted a solution but it seems that the solution doesn't appear. I'm linking a similar solution that takes the rotation vector from SolvePnP. https://answers.opencv.org/question/1... I haven't tested this solution.

edit retag close merge delete

1

I used to project 3 axes on a frame using cv2.drawFrameAxes function (so I do have the vectors and camera calibration)

so you should be close to what you want now. please show your code, so we can hook into it

( 2020-03-31 02:34:01 -0600 )edit
1

Hi, my code (the head pose part) is similar to: https://github.com/yinguobing/head-po... if you go to estimate_head_pose.py, you will see that they provide 3 options to project the results on the frame. The last commented option is drawing 3 axes. So how can I use the rotation and translation vector to calculate the 3 angles. Thank you for your time and effort. It's really appreciate.

( 2020-03-31 05:16:03 -0600 )edit
1

my code (the head pose part) is similar to XYZ

that's quite useless. we won't try to parse a 3rdparty github repo, trying to understand, what YOU did

( 2020-03-31 06:02:24 -0600 )edit
2

hello, thank you for your time. I've found the solution I've been looking for. Next time I will post my code strait away.

( 2020-03-31 10:36:00 -0600 )edit