Coders Packet

Real Time Face Detection Using Python (Haar Cascade & Face Recognition)

By Utsav Tripathi

This project aims to build a simple real time face detector (video based) using two different approaches namely, Haar Cascades and face_recognition module in Python.

This project is a simple real time face detector built using Python. Two different approaches were taken to build this project:

1. Using Haar Cascades

2. Using face_recognition library


The project:

1. Accesses the real time feed using the webcam or any other device.

2. Takes each frame and detects faces and number of faces in the frame.

3. Outputs the real time feed with the number of faces detected.


This project successfully is able to detect faces in a real time feed taken using OpenCV and can be tweaked to serve a number of different purposes such as,

1. Smile Detection - to detect a smile on the subject's face

2. Mood Detection - to detect a subject's mood

3. Heads Up or Headbandz Game Creation -

         There are three ways to play this game:

                 1. Without talking, someone acts out the word on the person’s head.

                 2. Using one word phrases someone describes the word without saying any form of the word.

                 3. The person who is wearing the sticky note on their head ask questions about the word i.e. is it an animal? is it food? etc.

        Above mentioned scenarios can be tweaked a bit to accomodate a computer in the playing circle. IT'S VERY INTERESTING!!!


While the project was made using two different approaches, the Haar Cascades approach resulted in a better speed and the face_recognition approach resulted in a better detection (assuming that the system running it is a normal laptop like mine!).

Download Complete Code


No comments yet