Showing posts with label gnomecam. Show all posts
Showing posts with label gnomecam. Show all posts

Saturday, April 10, 2010

Hand isolation in OpenCV

This week I've been working on some hand-detection algorithms in Python and OpenCV. I have come up with a simple and fairly accurate combination of filters that can isolate my skin tone from a range of backgrounds in a range of lighting conditions.

Overhead artificial lighting (click to enlarge).


Natural back-lighting (click to enlarge).

The Python script separates (in real-time) the RGB image from the webcam into Hue, Saturation and Value. The hue is filtered to the red band (which is the base hue of my skin) and the saturation is filtered to discard the bottom 25% (the lower the saturation, the greater the chance of error in the hue calculation). The filtered saturation and hue are then combined with an AND operation to return a highlighting of the hand.

Friday, April 2, 2010

Face detection with OpenCV 2.0 & Python 2.6


I've been wanting to play around with OpenCV under Python for ages and today I finally had the free time to have a go. Googling for some good tutorials lead me to a fantastic "hello world" script by Jo Vermeulen. The script used an OpenCV Python wrapper called CVtypes and was based on work done by Nirav Patel with an earlier version of OpenCV.

I wanted to work with the latest version of OpenCV and their new Python bindings so I decided to rework Jo's script for OpenCV 2.0. The results are above and the source code is available here: http://github.com/thisismyrobot/gnomecam/raw/master/face-detect.py

As a side note, I found the installation process for OpenCV under Ubuntu 9.10 utterly horrible. I eventually stumbled across this article that provided the correct steps to get it all working.