These projects are based on several articles that can be found on hackster.io , pyimagesearch.com, pythonprogramming.net, and opencv.org. Code samples have been adapted from these articles and code from the OpenCV github repository.
With your Raspberry Pi and a library called OpenCV you can identify objects in pictures or videos. If you want to install OpenCV on your own Raspberry Pi, you can follow the instructions here. It is not necessary to install OpenCV on the Norton Coders Club Raspberry Pi's since it has already been installed for you.
In this project you will take a picture of a your cat and use Python and OpenCV to find its face. There are several parameters that you will need to learn about and adjust to get the best results.
A parameter specifying how much your image size is reduced at each image scale. The scaleFactor is used to create what is called a scale pyramid. Scaling is done because the size of cat faces that were used to develop the detecting model (Haar Cascade) may be different from the size of cat face(s) you are using. By rescaling your input image, you can resize a larger face to a smaller one, making it detectable by the algorithm. It should be noted that upscaling is not done because that may introduce errors. The scaleFactor can range from greater than 1.0 to less than 2.0. We will start at 1.1 (a 10% reduction) and go to 1.5 (a 50% reduction). You may find that a smaller scaleFactor is better but in some cases it's dependent on the picture.
A parameter specifying how many neighbors each candidate rectangle should have to retain it. To say it another way, it's a parameter specifying the minimum number of neighboring facial features that need to be present for the classifier to declare that a face has been found. Decreasing the parameter increases the amount of false positive detections. Increasing the parameter might lead to missing faces in the image. 3~6 is usually a good value.
Minimum possible object size. Objects smaller than that are ignored. This parameter determines how small of a rectangle you want to detect. You decide it! Usually, [30, 30] is a good start for face detection.
Maximum possible object size. Objects bigger than this are ignored. This parameter determines how big a rectangle you want to detect. Usually, you don't need to set it manually, the default value assumes you want to detect without an upper limit on the size of the face or object.
NOTE: To startup and work with OpenCV projects you must start IDLE in a terminal with the following commands
source ~/.profile
workon cv
python -m idlelib
Then you have to open your program.py files using File -> Open in the IDLE interface.