DEV Community

petercour
petercour

Posted on

Face Detection with Python

face detection

You can detect faces using Python. These faces can be in a still image, video or web cam feed.

All of this can be done with only a few lines of code!

The method used here uses Machine Learning. Machine Learning is a part of Artificial Intelligence, that uses data to make new predictions.

In this case you want to predict if there's a face in the image.

Getting started

You will need Python 3.x and OpenCV 2 installed. You'll also need a cascade file, which OpenCV uses to detect faces.

OpenCV can be installed with the Python package manager:

pip3 install opencv-python

You'll also need the runtime opencv package.

Face detection uses the machine learning approach: given statistical examples, predict if there is a face in the image.

Read more: https://pythonbasics.org/face-detection/

Top comments (0)