Cascade classifier detection and training
One might be wondering how OpenCV could detect faces as this would be a very straightforward task for a couple-of-month old baby, and it looks quite complicated to tell a computer how to accomplish it. We will divide the problem in two parts—object detection, which is applying a classifier and retrieving the object position when the classifier says so, and training a new classifier to learn new objects that should be mostly rigid.
OpenCV Cascade Classifier initially implemented a face-detection technique known as the Viola-Jones detector, first developed by Paul Viola and Michael Jones, which uses the so-called Haar-like features, named after Alfréd Haar wavelets. These features are based on thresholds of sums and differences of rectangular regions of raw image values. Later, this classifier also enabled the use of Local Binary Patterns (LBP) features, which are integer values in contrast to Haar-like features; this results in faster training times...