How to calculate a facial point grid using OpenCV and Python?

Viewed 96

I'm trying to automatically draw a mesh or grid over a face, similar to the image below, to use the result in a blog post that I'm writing. However, my knowledge of computer vision is not enough to recognize which model or algorithm is behind these types of cool visualizations.

Could someone help pointing me some link to reador or a starting point?

enter image description here

Using Python, OpenCV and dlib the closest thing I found is something called delauny triangulation but I'm not sure if that's exactly what I'm looking for seeing the results.

Putting it in a few words what I have so far is:

  1. Detect all faces on image and calculate their landmarks using dlib.get_frontal_face_detector() and dlib.shape_predictor() methods from dlib.

  2. Use the method cv2.Subdiv2D() from OpenCV to compute a 2D subdivision based on my landmarks. In particulary I'm getting the delauny subdivision using the getTriangleList() method from the resulting subdivision.

The complete code is available here.

However, the result is not so attractive perhaps because the division is using triangles instead of polygons and I want to check if I can improve it!

0 Answers
Related