O'Reilly logo

Learn OpenCV 4 by Building Projects - Second Edition by Prateek Joshi, Vinicius G. Mendonca, David Millan Escriva

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

Get your sunglasses on

Now that we understand how to detect faces, we can generalize that concept to detect different parts of the face. We will be using an eye detector to overlay sunglasses in a live video. It's important to understand that the Viola-Jones framework can be applied to any object. The accuracy and robustness will depend on the uniqueness of the object. For example, the human face has very unique characteristics, so it's easy to train our system to be robust. On the other hand, an object such as a towel is too generic, and it has no distinguishing characteristics as such, so it's more difficult to build a robust towel detector. Once you build the eye detector and overlay the glasses, it will look something like this:

Let's ...

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