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 👍

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Anmol Malik
Anmol Malik

Written by Anmol Malik

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

No responses yet

Write a response