March 2020
Intermediate to advanced
366 pages
9h 8m
English
The process_frame method is called on all the images, and we'd like to show a frame around a face when it appears in the video feed. This is illustrated in the following code block:
def process_frame(self, frame_rgb: np.ndarray) -> np.ndarray: _, frame, self.head, _ = self.face_detector.detect_face(frame_rgb) return frame
We have just called the FaceDetector.detect_face method of the self.face_detector object we created in the constructor of the layout class. Remember from the previous section that it detects faces in a downscaled grayscale version of the current frame using Haar cascades.
So, we are adding a frame if we recognize a face; that's it. Now, let's look at how we store training images inside the ...