Snapchat-based augmented reality OpenCV glasses overlay

In a similar fashion, we have also coded the snapchat_agumeted_reality_glasses.py script to overlay a pair of glasses on the eyes region of the detected face. In this case, in order to detect the eyes in the image, the eye-pair detector is used.

Therefore, the classifier should be created accordingly:

eyepair_cascade = cv2.CascadeClassifier("haarcascade_mcs_eyepair_big.xml")

In the next screenshot, you can see the output of the algorithm when the test image is used:

The cyan rectangle indicates the position and size of the detected face in the image. The magenta rectangles indicate the ...

Get Mastering OpenCV 4 with Python 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.