Face Detection in Python

Agnel Selvan
2 min readMar 13, 2022

In this blog we’ll be focusing on the implementation of Face Detection using Python.

Python Installation

Make sure to install the Python. I’m using Python 3.8.0 to check your current python version run python3 — version in your terminal.

Package Installation In Python

Install OpenCV in python using the command pip3 install opencv-python.

Adding Required Assets

Adding required assets in the project folder.
First add the frontalface xml file. Download the haarcascade_frontalface_default.xml from the Github Repo.
Add a image in the project directory.

Python Program

I have named the image as sample.jpeg you need to change it accordingly.

Run your Program

Run your program using the Command line python3 main.py or if you using vsCode press F5 to run.

Hurrah! and we are done with the Face Recognition using Python.

Do you know you can press the clap👏 button 50 times? The higher you go, the more it motivates me to write more stuff for you guys!
Hello, I am Agnel Selvan. A noob developer. You can find me on Linkedin or stalk me on GitHub.



Agnel Selvan

A person who is learning Flutter Development, Shaders, OpenGL, and Augmented Reality.