We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Detecting movement (Read 1182 times)
Detecting movement
Mar 14th, 2007, 1:51pm
 
Hi
I am working on a college project which goal its to recreate a windows application such as the eyetoy for the playstation 2.
I basically have a webcam and on top of the live video feed I would like to add some objects (2D or 3D) which can be manipulated by movement of a person. The best example I can find (and done using processing too) is here:

http://setpixel.com/content/?ID=fire

and there are a few more here:

http://setpixel.com/category/?ID=20

I was just wondering if anyone has experience in this field and can give me a few hints on how to go about detecting movement (the area where it took place) and the direction of the movement
Re: Detecting movement
Reply #1 - Mar 31st, 2007, 7:58pm
 
On that site, it says the source code is available. But I cannot seem to find it there.

Have you found it?

Christopher
Re: Detecting movement
Reply #2 - Mar 31st, 2007, 9:00pm
 
no. i didnt find any either.
i also tried to contact the guy but no reply Sad
Re: Detecting movement
Reply #3 - Apr 2nd, 2007, 1:29pm
 
Each time your webcam updates you need to cache a frame. Then on the next update you campare the old frame to the new frame and measure the difference between the two's pixels. The difference you save in a third image which should look all black apart from those funky bits where there's movement.

To make the water effect I suggest taking a look at this code:

http://viz.nu/programming/processing/splish

it's short and sweet and easy to hack. (God bless the guy who wrote it)

To make the water effect you would use the difference measurements as points to push against the height map the water effect uses. In the demo above he's just getting the mouse position and forcing a push from the mouse position - do the same from the webcam data.


I was going to do this in Flash but when I tried to run just the water effect the thing operated at 1 frame every 5 seconds. Sad

I've no idea how you would do the fire effect. Just do the water effect and post up the code so we can have an end to people bringing the setpixel "I love water" requests for code. To be honest I'd love to get my hands on that code too, but now that I've figured it out I feel I have other fish to fry. Goog luck.
Page Index Toggle Pages: 1