Crossing the High Atlas Mountains

Today was one of the most memorable days of my travels so far. Memorable and traumatic. In the morning, we visited Le Jardin Majorelle. I wasn’t going to leave Marrakech without a visit. I loved it…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Facial Landmarks and Face Detection in Python with OpenCV

Sample out of facial landmark detection in which three faces were detected.
Facial Landmark Detection Sample

Facial landmark detection is the process of detecting landmarks or regions of interest (key-points) on the face like Eyebrows, Eyes, Nose, Mouth and Jaw silhouette.

Some applications of facial landmark detection are face swap, head pose detection, detecting facial gestures, gaze direction etc.

This project was done on a jupyter notebook.

Before you start you should have the following installed on your computer:

The following packages are required, you can install them with pip from your command-line:

NOTE: The downloaded classifier and model must be moved into the same directory with your .ipynb file for this tutorial.

On your Interactive Python Notebook (*.ipynb) import the following

(R-L: Donald Trump, President of the United States of America and Justin Trudeau, Prime Minister of Canada)

On line 2, convert the image from BGR to RGB colour
On line 8,9 crop image to a specific size using the image’s axes, with top-left of the image being (0,0). Use image[y:y+depth, x:x+width], where x and y are the left-hand-side axes to start the cropping. width and depth are the x and y dimensions(length) for the cropped image respectively.
Line 15 converts image to grayscale, note that face detection algorithm used here performs better on grayscale images.

The output of face detection.
Face Detection Output

Three faces are detected on the image.

Sample out of facial landmark detection in which three faces were detected.
Facial Landmark Detection Output

Below are the detections zoomed in.

Zoomed in output of landmarks detection
Zoomed output

Thanks for reading!

Add a comment

Related posts:

Perigo para os polegares

Reportagem para o Jornal da PUC-Rio. “Perigo para os polegares” is published by Karen Krieger.

What Kind Of Viewer am I?

When people first meet me, I assume they think all kinds of things about me. I assume they think I’m too quiet or that I have an odd shirt on. I assume because I work as a mechanic people think that…

HackerRank SQL

We define an employee’s total earnings to be their monthly salary* months worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query…