Primordial Soup

toronto interactive playground

experimentation: webcam input interaction in Flash

Posted by: Tina · Date: 2011-10-16 17:17:11 · Share:

If you’ve ever considered using your webcam to capture motion and interact with a Flash game on screen, here’s what I did.

Mad Inventor Dan Zen has made publicly available his module called Ostrich: Flash webcam motion cursor, to anyone who wishes to use motion capture technology in their Flash applications and games. The input can be choppy, but for Flash and any old webcam, it’s as accurate as you can expect. The best part about this module is that Dan’s made it available for free to anyone to use (in return for a bit of credit, I’m sure).

In my experimentation, I wed Dan’s Two Cursors sample with a version of the classic Pong game, Ping Pong by Jackson Dunstan.

Webcam Pong in Action

Webcam Pong in Action

In this example, as you can see, I made a few small changes. I added my logo as the ball, added a sound to the ball so it plays every time it hits something, and added the webcam as a potential input for the game (it still loads the original mouse game if you have no webcam, or if you deny the webcam). The resulting app is a pretty fun beginning exploration – and I can’t wait to take it further and see how I can affect whole pieces of art through webcam input. I’m even considering buying an Xbox Kinnect for more precise computer vision.

In my explorations about this type of human-computer interaction, I came across this beautiful example of webcam affected art by Justin Windle.

Check it out:

Justin fully describes his way of doing motion detection and tracking on his blog, but essentially it uses a Motion Tracker class he coded, and modifies the input with blurring and easing to emulate smoother interactions.

The user zinc roe on YouTube, has some interesting Flash experiments with motion detection and tracking. He doesn’t post how he’s done the work, but they are definitely worth keeping in mind for further motion reaction experiments in Flash. Maybe I’ll take one of the two above methods of motion tracking and try to emulate some of the experiments he’s made.

Leave a Reply