Wednesday, October 20, 2010

Codebox: Lose your head with OpenCV

Codebox: Lose your head with OpenCV: "

OpenCV is a 'library of programming functions for real time computer vision.' An open source project supported by Willow Garage, the library contains over 500 algorithms for image manipulation, object detection, feature extraction, and a variety of other tools you can use to write programs that can 'see.'

The OPENCV Processing and Java Library, a project maintained by Stéphane Cousot and Douglas Edric Stanley at the École Supérieure d'Art d'Aix-en-Provence, provides a wrapper that allows you to use a subset of OpenCV in Processing. In honor of Halloween, this Codebox will show you how use OpenCV to remove people's heads in real-time from a video feed. For example:

Future posts will cover less gruesome applications for this awesome library.

Installing OpenCV Processing and Java Library

The fist step in using the library is to download and install it from http://ubaa.net/shared/processing/opencv/. The site's documentation is great — just follow the steps listed on the "Installation Instructions" on the main page. Once you've followed the steps, fire up Processing, and then try out the code in the detect() example, which puts a red rectangle around any faces (frontal view) detected in the webcam. You should see something like this: