I have a friend who is keen to implement a form of webcam-based motion tracking (basically, using a webcam to interact with objects on stage) as a "proof of concept" section in her masters degree.
It strikes me Processsing would probably be more efficient than Flash (although, I have not yet experimented with AS3 tracking)
I have found several examples of flash motion tracking, and I am sure there are Processing examples - but my google skills are failing me.
Does anyone have any ideas or suggestions?
I have a C# app that I wrote, mostly from examples on the web, that does motion tracking using a webcam. If the source is of any use PM me and i'll dig it up.
It is, actually, though my friend uses a Mac, I do C#. Not sure if I could get a working example on a Mac
Thanks, though, I'll let you know next year- I am certainly not doing anything during my holidays.
Flash is probably going to be most reliable way to access webcam? Persist book has an as2 detect spot example and as3 will give you some more compute power.
If you look at haxe you can code for flash and later it might become possible to use NME/neash to retarget other platforms ( neash, c++, silverlight, and always talk of java support ) using the same haxe and also you can look at moving some number crunching to neko/php, communication prob too slow but this is education so its more about exploring and writting up findings? Sorry i have been harping on about haxe but it might just fit here and nicholas work means you can easily save video to the server for after the event processing.
Moving to Projects&Theory 
They're competitive.
My AS 2 book has a seciton on messing with flash webcam pixels for VERY rudimentary motion detection based on color field changes.
I ported it to processing as i was writing the section. I couldn't see a performance difference in either platform. The frame rate of most webcams, even set to max, is the limitation, not the speed flash or java can run through arrays.
From an academic point of view, and a certain snobby academic documentation, and if I were a professor, I would be urging her to work with Processing, cause processing has a more archival feeling to it, and will mesh with a thesis better. Flash will never lose its banner ad perception. Also, with processing, its just code, there's no IDE to climb over or learn. If she does it in processing it will be about her ideas. If she does it in flash it will be about her ideas as flash.
Here's a very simple example i just knocked up to get you started. It's not the best way to go about it, but will give you a place to go from...
import processing.video.*;
/* * @author andrewwright * andrew@snepo.com */
int W = 640; int H = 480;
color pColor; Capture cam;
int res = 3; int thresh = 20;
color[] buffer;
void setup() { size ( W, H ); background(0);
buffer = new color[W * H]; cam = new Capture(this, W, H);
}
void captureEvent(Capture cam) { cam.read(); }
void draw() { sampleAndPaint(); swapBuffer(); }
void sampleAndPaint() { fill(0, 10); rect(0, 0, W, H); for ( int i = 0; i < W; i+= res ) { for ( int j = 0; j < H; j+=res ) { int offset = i + j * W; color c = cam.pixels[offset]; color r = buffer[offset];
float cB = brightness(c);
float rB = brightness(r);
float delta = abs ( cB - rB );
if ( delta > thresh )
{
fill ( 0, 255, 0 );
noStroke();
rect ( i, j, res, res );
}
}
} }
void swapBuffer() { arrayCopy(cam.pixels, buffer); }
Most appreciated.
I expanded and experimented with an example Persist did. I don't know if it'd help but I'd be happy to get it to you, it worked alright if a little slowly because of ... I'll shortly describe it, maybe it can be adapted to whatever. It works with a plugin called "FlashMIDI" and Ableton Live 6 plus Bome's Midi Translator if I remember correctly (I did it almost a year or so ago).
The camera view of 480x320 gets divided into a grid - say 8x8 - and each section gets assigned a number. Then, each section gets assigned one or more instruments and a few parameters like the note duration, range of notes, etc. as well as as being able to accept different camera/motion settings. Then you make some motions, dance, whatever in the camera view and different notes and instruments get played in Ableton depending on which section of the camera the movement is in and how much movement, which pixels in the sections, assigned various algorithms to adjust based on which pixel in a section, etc.
Using Bome's Midi Translator I managed to control browsers and other applications, including the X10 "Firecracker" which attaches to a serial port and sends a wireless signal to electric wall plugins which can be used to turn on/off/dim lights or turn on/off other electrical appliances and I managed to send messages using VXML to control a telephone application and made a connection with Asterisk.
I just looked and I have some of the versions easily at hand but it seems I've neglected it since March - I do remember that the thing became so complex that my quad core with DDR3 ram, etc still became sluggish. I never did have any purpose beside "experimentation" but I believe I could make it work again but I'd really rather not. I'm sure I could get something simple going but by the time I moved on my brain was hurting.
Here is one XML configuration file I've found of what seems to be a 2x2 grid and various instruments ...-
Originally posted by: jamiec I have a C# app that I wrote, mostly from examples on the web, that does motion tracking using a webcam. If the source is of any use PM me and i'll dig it up.
I know it was a while ago that you posted this and you may not have the source code anymore but do you think I could possiby have a look at this. Just started on my masters degree and this could come in very helpful as this is very similar to what I am doing
You may want to send jamiec a personal message.