Computer Vision: Face Detection Using Python and OpenCV

Share At:

What is computer vision?

Computer vision is a field of artificial intelligence (AI) that enables computers and systems to derive meaningful information from digital images, videos and other visual inputs — and take actions or make recommendations based on that information. If AI enables computers to think, computer vision enables them to see, observe and understand.

Computer vision works much the same as human vision, except humans have a head start. Human sight has the advantage of lifetimes of context to train how to tell objects apart, how far away they are, whether they are moving and whether there is something wrong in an image.

Computer vision trains machines to perform these functions, but it has to do it in much less time with cameras, data and algorithms rather than retinas, optic nerves and a visual cortex. Because a system trained to inspect products or watch a production asset can analyze thousands of products or processes a minute, noticing imperceptible defects or issues, it can quickly surpass human capabilities.

Overview of Face Detection

Face detection has a wide range of applications in today’s era like attendance management system, home security etc. In this example we are detecting faces in an image.

Working Example:

  1. Upload the following Jupyter notebook in Google Colab:
  1. Upload test2.jpg and face_detector.xml files in your Google Colab working directory. test2.jpg is the image file on which we will be performing our test on.

The files can be found in github repo: The code

test2.jpg:

  1. When you have uploaded all the files, Click on Runtime –> Run All.
  1. After successful run you will see a message displayed that says “Photo Successfully Exported”:
  1. Now open the file called “face_detected.png”. You will see a blue rectangle around the face of the image. This means the face has been detected.

face_detected.png:

That concludes our learning on Face Detection.

Happy Learning !!!


Share At:
0 0 votes
Article Rating
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
gate.io
3 months ago

Your article helped me a lot, thanks for the information. I also like your blog theme, can you tell me how you did it?

Navifuture.de
1 year ago

Great content! Keep up the good work!

Back To Top

Contact Us