How to do it...

In this recipe, we will learn how we can build, using OpenCV, a boosted cascade of features to produce a 2-class classifier. However, before we do, let's explain the terminology that is used here. A 2-class classifier is one that can identify the instances of one class (for example, face images) from the rest (for example, images that do not contain faces). In this case, therefore, we have the positive samples (that is, face images) and the negative samples (that is, non-face images); these latter images are also called background images. The classifier of this recipe will be made of a cascade of simple classifiers that will be sequentially applied. Each stage of the cascade will make a quick decision about rejecting, or not, ...

Get OpenCV 4 Computer Vision Application Programming Cookbook - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.