cansik / mediapipe-face-geometry

MediaPipe Face Geometry example in python.
MIT License
12 stars 1 forks source link

mediapipe face rotation #1

Open isdito opened 1 year ago

isdito commented 1 year ago

Good evening,

I have seen that you were also looking for a way to have the orientation of the face, I am looking for a way to know the yaw pitch and roll of the head, but I can't find any example of the python code, would you mind telling me where to look for it.

reggards

cancan101 commented 1 year ago

Using pose_mat from: https://github.com/cansik/mediapipe-face-geometry/blob/22240f9d023ce9b2e458740791ae1c964b788f68/demo.py#L74 I think you can do:

cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ, eulerAngles = cv2.decomposeProjectionMatrix(pose_mat[:4, :3].T)

and then use the eulerAngles.