Skip to Content
Mastering OpenCV 4 with Python
book

Mastering OpenCV 4 with Python

by Alberto Fernández Villán
March 2019
Intermediate to advanced
532 pages
13h 2m
English
Packt Publishing
Content preview from Mastering OpenCV 4 with Python

Detecting facial landmarks with dlib

Another option is to use the dlib library to detect facial landmarks. In the landmarks_detection_dlib.py script, we detected facial landmarks using dlib. More specifically, we used the images taken from the webcam to perform face detection using dlib frontal face detection. We also offer the possibility of taking the image from a test image. The next step is to get the shape using the shape predictor:

p = "shape_predictor_68_face_landmarks.dat"predictor = dlib.shape_predictor(p)shape = predictor(gray, rect)

The following step is to transform shape into a numpy array. In this sense, shape is a dlib full_object_detection object, which represents the location of an object in an image with the positions ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

OpenCV 4 with Python Blueprints - Second Edition

OpenCV 4 with Python Blueprints - Second Edition

Dr. Menua Gevorgyan, Michael Beyeler (USD), Arsen Mamikonyan, Michael Beyeler
Learning OpenCV 3

Learning OpenCV 3

Adrian Kaehler, Gary Bradski
Machine Learning for OpenCV 4 - Second Edition

Machine Learning for OpenCV 4 - Second Edition

Aditya Sharma, Michael Beyeler (USD), Vishwesh Ravi Shrimali, Michael Beyeler

Publisher Resources

ISBN: 9781789344912Supplemental Content