Python | Haar Cascades for Object Detection
Object Detection is a computer technology related to computer vision, image processing and deep learning that deals with detecting instances of objects in images and videos. We will do object detection in this article using something known as haar cascades.
What are Haar Cascades?
Haar Cascade classifiers are an effective way for object detection. This method was proposed by Paul Viola and Michael Jones in their paper Rapid Object Detection using a Boosted Cascade of Simple Features .Haar Cascade is a machine learning-based approach where a lot of positive and negative images are used to train the classifier.
- Positive images – These images contain the images which we want our classifier to identify.
- Negative Images – Images of everything else, which do not contain the object we want to detect.
- Make sure you have python, Matplotlib and OpenCV installed on your pc (all the latest versions).
- The haar cascade files can be downloaded from the OpenCV Github repository.
Code : Detecting the eyes
Code : Detecting face and eyes
Haar Cascades can be used to detect any types of objects as long as you have the appropriate XML file for it. You can even create your own XML files from scratch to detect whatever type of object you want.
Attention reader! Don’t stop learning now. Get hold of all the important Machine Learning Concepts with the Machine Learning Foundation Course at a student-friendly price and become industry ready.