January 2018
Intermediate to advanced
268 pages
6h 20m
English
Just like before, we first load the face cascade classifier XML file. The face detection steps work as usual. We start the infinite loop and keep detecting the face in every frame. Once we know where the face is, we need to modify the coordinates a bit to make sure the mask fits properly. This manipulation process is subjective and depends on the mask in question. Different masks require different levels of adjustments to make it look more natural. We extract the region-of-interest from the input frame in the following line:
frame_roi = frame[y:y+h, x:x+w]
Now that we have the required region-of-interest, we need to overlay the mask on top of this. So we resize the input mask to make sure it fits in this region-of-interest. ...
Read now
Unlock full access