OpenCV Series — 4— Dlib 68 point face landmark prediction

Rajathithan Rajasekar
1 min readMay 8, 2020

In this post , we will be detect and predict 68 points in human faces using dlib’s pre trained model , the model details are available in the below link,

shape_predictor_68_face_landmarks.dat

dlib.get_frontal_face_detector() is used in detecting the face in a frame or image.

dlib.shape_predictor() is a tool that takes in an image region containing some object and outputs a set of point locations that define the pose of the object.Here we use the shape_predictor_68_face_landmarks.dat model create the predictor object. We then pass the frame and the detected rectangle dimensions.

The detected landmarks are then plotted on the frame using cv2.circle

import cv2def renderFace2(im, landmarks, color=(0, 255, 0), radius=3):    for p in landmarks.parts():         cv2.circle(im, (p.x, p.y), radius, color, -1)

The python file is given below for your reference.

Thanks for reading this post, hope you found it useful.

Previous-Post………………………………………………………Next-Post

--

--

Rajathithan Rajasekar

I like to write code in Python . Interested in cloud , dataAnalysis, computerVision, ML and deepLearning. https://rajathithanrajasekar.medium.com/membership