O'Reilly logo

Instant OpenCV for iOS by Kirill Kornyakov, Alexander Shishkov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Detecting faces with Cascade Classifier (Intermediate)

In this recipe, we'll learn how to detect faces using the cv::CascadeClassifier class from OpenCV. In order to do that, we will load an XML file with a trained classifier, use it to detect faces, and then draw a rectangle over the detected face.

Getting ready

Source code for this recipe can be found in the Recipe04_DetectingFaces folder in the code bundle that accompanies this book. For this recipe, you will need to download the XMLfile from the OpenCV sources at http://bit.ly/3848_FaceCascade. Alternatively, you can find the file in the resources for this book. You can use the iOS Simulator to work on this recipe.

How to do it...

The following are the basic steps needed to accomplish the task: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required