Coders Packet

Face Detection using C++ and openCV library

By Shubham Saxena

A C++ project to detect faces and highlight them in the real-time webcam video using Haar Cascade.


This packet can be used to detect faces in a webcam video. This project is based on C++ and OpenCV library. It recognizes the real time faces in the real-

time feed using a webcam.


In this project, face detection works on haar cascades, which is a machine learning approach where a cascade function is trained with a set of input data. 

Object detection using Haar feature-based classifier is an effective way of detecting objects. OpenCV library has many pre-trained classifiers for face,

eyes, etc. In this project, only a face classifier has been used.


1. System should have OpenCV installed.

2. System should have GCC installed.

3. Any IDE (preferably Xcode or Visual Studio as setup of OpenCV will be easier in these)

4. Developer must give the correct path of the classifier XML file in the code. Specifically, this (haarcascade_frontalface_alt.xml) is the classifier that has 

been used in the project.


Output detects the number of faces in the real-time video and highlights them.

Thanks & Happy Coding :)






Download Complete Code


No comments yet