-
Notifications
You must be signed in to change notification settings - Fork 0
Original Instructions
Computer Vision with OpenCV
Install Python 2.x: http://www.python.org/downloads/ Install OpenCV 3 Alpha: http://opencv.org/ Install guides: http://tinyurl.com/cu5euoa Source code link: http://tinyurl.com/nra4cxq
Test your install by opening Command Prompt or Terminal and entering the Python interpreter:
python
Type the following to import the OpenCV module and print it’s version number:
import cv2 print cv2.version (that’s two underscores in a row before and after version)
If the install is good you will see something with 2.4.x or 3.0.x in the output. If the output doesn’t contain anything about the version number then it’s prior to version 2.4 and may not include the necessary functions for vision development today.
Download the zip file and extract into a folder. In Terminal, change directory into that folder. You can now run the Python scripts by name.
Run the face-test-ocv2.py script:
python face-detect-ocv2.py
You should see a green rectangle around the faces.
Script Details
anypic-face-ocv2.py requires the first command line argument to be the name of an image for which you would like to know if a face exists within or not.
python anypic-face-ocv2.py mypicture.jpg rainbow-face-ocv2.py detects the faces in the four image files and draws rectangles around them in different colors.
python rainbow-face-ocv2.py video-face-ocv2.py opens the webcam (if present) and starts looking for a face in the live video. Pressing Escape exits.
python video-face-ocv2.py outlet-ocv2.py shows a custom Haar cascade that detects AC power outlets.