Face Detection using Haarcascade Classifier and OpenCV

Abhishek Biswas
2 min readFeb 24, 2022

The objective of this article is to detect face in real time and also real time tracking of face. This is perform using a python library called OpenCV which is a library of computer vision. And the programming language is used is python of version 3.10.0.

Steps to be followed before starting.

  1. First download NumPy and OpenCV library using pip installer. The step of downloading of python library is same for Windows, Linux and Mac. The step of downloading of python library is pip install <package_name> in terminal of any Operating system and the package will be downloaded.
  2. Download the Haarcascade classifier from this link https://github.com/opencv/opencv and after downloading go to the data folder and then enter to the Haarcascade folder and then copy two files name haarcascade_frontalface_default.xml and haarcascade_eye.xml. And then put the files on the same folder where the project is created.

Implementation.

Output of this Implementation.

The output of this program implementation successfully detects the face and also the eye using the Haarcascade algorithm and OpenCV python library.

Face Detection using the Haarcascade classifier implemented using OpenCV-python
Face and Detection using the Haarcascade classifier

References.

  1. https://docs.opencv.org/2.4/modules/objdetect/doc/cascade_classification.html?highlight=cascadeclassifier#cascadeclassifier
  2. https://docs.opencv.org/3.4/da/d60/tutorial_face_main.html
  3. https://github.com/opencv/opencv

Thank you.

And I also gives thanks to the users for reading my article. please check this GitHub link for getting the full code.

https://github.com/abhishekthegodfather/face_detection

--

--