Coders Packet

Real-Time Face and Eyes Detection Using OpenCV-Python and Haar Cascades

By Pooja S Deshpande

In this packet, we perform real-time face and eyes detection through a webcam using OpenCV library and Haar Cascade pre-trained models.


In this packet, we perform Face and Eyes detection through a webcam. We use the OpenCV library to capture video frames in a video and apply object detection using pre-trained models called "Haar Cascades". Haar Cascades are algorithms that involve some calculations being carried out on adjacent rectangular areas in an image or a video frame.


Steps To Execute:

1) Download Zip

2) For getting Haar Cascade XML files ( for face: haarcascade_frontalface_default.xml, for eyes: haarcascade_eye.xml ), you can use the ones that are provided in the zip.

3) Store these haar cascades (XML) files in the same project folder where your main python file is located.

4) We require OpenCV library; To download --> pip install opencv-python.

5) Open the "" file from the Zip and run it.


(You should get output as shown below:)

**NOTE**: Be in a well-lighted area to be able to get your face and eyes detected properly.

Download Complete Code


No comments yet