For my ICM midterm, I decided to dive into the openCV library for Processing and play around with facial recognition via webcam input. My initial idea was to use input from the webcam to control the ghosts that I had animated for my week 5 homework assignment. My first thought was to track eye movement and to have the ghosts on screen follow the user’s area of focus. Of course, after looking to the capabilities of openCV, I realized that such sophisticated analysis/tracking of webcam input was probably outside the scope of what openCV is capable of. So, I had to modify my original idea and instead, decided to replace the user’s face (or users’ faces) with a vector image instead. My thought was that this would result in a sort of augmented reality Halloween mask, allowing the user to alter his or her appearance without having to endure the discomfort of wearing a physical mask.
The first step was adding drawing the webcam input on the screen and overlaying the animation. This was fairly easy and could be accomplished without the use of openCV.
Next, I used openCV to add facial recognition. I found some sample code online that would draw a red rectangle around a detected face, so I used this for testing/debugging purposes.
Finally, I replaced the red rectangle with a vector image of a pumpkin. The pumpkin not only follows the user’s face around the screen but also scales in size, depending on the user’s proximity to the webcam.
There was more that I wanted to do with this–I wanted there to be some sort of interaction between the user’s face and the animated ghosts but I wasn’t able to implement that in time. I’d also like to allow the user to select which mask to wear from a list of options but I didn’t have enough time to create vector images for multiple masks. All ideas for future iterations of the program, I suppose.
Also, I can’t seem to figure out how to get openCV to play nice with JavaScript, so for the time being, I won’t be able to post a functional version of the program here.

Tom
October 31, 2011 at 10:07 pm
Letting the user select the mask out of multiple options would be a nice feature to implement in future versions. Keep up the good work!