Understanding it better
We need a classifier model that can be used to detect faces in an image. OpenCV provides an XML file that can be used for this purpose. We use the function CascadeClassifier to load the XML file. Once we start capturing the input frames from the webcam and use the detectMultiScale function to get the bounding boxes for all the faces in the current image, in case frames are not passed in grayscale, this is going to run internally at the method, as grayscaled frames are required to process the detection. The second argument in this function specifies the jump in the scaling factor, as in, if we don't find an image in the current scale, the next size to check will be, in our case, 1.3 times bigger than the current size. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access