liveBook · Manning

Cascade classifier

As explained in Build Your Own Robot: Using Python, CRICKIT, and Raspberry Pi

CascadeClassifier is an OpenCV API that constructs a cascade-classifier object from a trained model file.

A cascade classifier is an OpenCV object created from a trained XML model file. For face detection, OpenCV supplies pretrained Haar feature-based cascade models in its data directory. section 9.3.1

Detecting a face

Load photo.jpg, convert the frame to grayscale, equalize its histogram, and call face_classifier.detectMultiScale(clean). A sample image returns one face represented by [215, 105, 268, 268].

How Build Your Own Robot: Using Python, CRICKIT, and Raspberry Pi covers it

How deep it goes
Explains model loading and detection preprocessing, while deferring the underlying cascade theory to OpenCV documentation.
Examples
Uses a Raspberry Pi camera image named photo.jpg and reports detected face coordinates.
What you can do after
Apply it via OpenCV to construct a face detector and locate faces in processed images.
How it connects
Connects OpenCV, Haar feature-based cascade classifiers, machine learning, grayscale conversion, and histogram equalization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Your Own Robot: Using Python, CRICKIT, and Raspberry Pi. The section links point to the parts of the book it draws on.