To solve this run the following # main opencv pip install opencv-python # contrib package for the extra features pip install opencv-contrib-python The official installation instructions are on the opencv website. More info can be found here: https://www.pyimagesearch.com/opencv-tutorials-resources-guides/
Here is what the above code is Doing:
1. We import the cv2 module.
2. We load the image into memory.
3. We convert the image to grayscale.
4. We load the face cascade, which is the XML file that contains the classifier.
5. We detect faces in the image.
6. We loop over the faces and draw a rectangle around each one.
7. We display the image.