I have extracted facial landmarks using mediapipe and stored it in a csv file. When I visualised the face using the 468 x-and y-coordinates, the face that I depicted is rotated in roll, yaw, and pitch axes. I would like to ask how can I rotate the landmark coordinates so that the face can look upright and straightforward?
I have tried to rotate the coordinates in the roll axis with a rotation matrix
rotation_matrix = np.array([[math.cos(angle), -math.sin(angle)], [math.sin(angle), math.cos(angle)]])
However, I have no idea how can I rotate the landmarks in the pitch and yaw axes with the x- and y-coordinates I got. Can anyone help me figure this out?
I am using Python to work on this.