Face Detector in Python OpenCV🤖

Anmol Malik
Jun 29, 2021

OpenCV is an open-source library that is used to detect faces, things, eyes, full-body in python.

Depedencies : Python3 && opencv

File : Download the haar_cascade file👈 from Github and add it to the working directory

Code👇

Code

Explanation

🔹Importing the library.

🔹Adding the image, converting it to gray, and showing both.

🔹Creating a classifier using haar_cascade file

🔹 Looping through the file to get the coordinates.

🔹 Using coordinates to surrounding face by reactangle.

Extras

🔹waitKey(0) is must

🔹 To change the color of the rectangle change (0,255,0) in the looping.

🔹 If the number of persons in the image is more than 5 then decrease the minNeighbour and vice-versa.

🔹To quit press q

Check it out Face Check for a GUI interface Face recognizer and Detector.

If you think it helps give it a 👍

--

--

Anmol Malik

Hii I am a developer. I am here to gain and share knowledge related to computes, coding.