OpenCV's cvtColor converts a color image into another representation. For face detection, convert the camera image to grayscale so each pixel contains one intensity value instead of three color components. section 9.3.1
Prepare an image for face detection
Load the image, convert it with cv2.COLOR_BGR2GRAY, then inspect the result. A 640×480 color frame with shape (480, 640, 3) becomes a grayscale image with shape (480, 640), where intensities range from black at 0 to white at 255. Histogram equalization can then improve contrast before detection. section 9.3.1
>>> gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
Runnable OpenCV call for converting a camera frame from BGR color to grayscale. section 9.3.1
