Assuming that you have successfully installed OpenCV, we can test this out by simply importing cv with Python. Open up a Terminal and type python to start the shell and then, type the following command:
If everything goes OK and there are no errors on the screen, you should be fine. Else, go back and reinstall OpenCV as described previously. Now, let's break down the actual code, which you can find and download from the following link:
In the face_detect.py script, the abba.png image, and the haarcascade_frontalface_default.xml are the following. When executing the file, you have to pass these two arguments:
# Get user supplied values
imagePath = sys.argv
cascPath = sys.argv
As a result, you first pass in the image and then, cascade names. In the following example, we will use the Abba image...