Jose Ramon
Jose Ramon

Reputation: 5444

Face alignment in video using python

I want to perform face aligment in a sequence of frames from video. I am using itraface face detector tracker which tracks points of interest in the face. Those points ca be found here:

enter image description here

What I want to is to rotate (using Python code). My question is if there is a way to calculate the rotate angle using the points from the eyes or the mouth (extreme right and left points of the eye or the mouth). How can I calculate that angle?

Upvotes: 0

Views: 2166

Answers (1)

Tiphel
Tiphel

Reputation: 323

Get both eye regions from your landmarks to compute the center of each eye. Then get the center point between the eyes. This is the point you want to rotate the face around. Then use the coordinates of the both eyes to find the angle and build the rotation matrix with cv2.getRotationMatrix2D

You can find the details of this method here

Upvotes: 2

Related Questions