Get your sunglasses on

Now that we understand how to detect faces, we can generalize this concept to detect different parts of the face. We will use 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, a 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 there are no distinguishing characteristics as such. So, it's more difficult to build a robust towel detector.

Once you build the eye detector and overlay glasses on top of it, it will look something like this:

Let's ...

Get OpenCV By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.