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.
IndexDiscussionExhibition › Motion trails
Page Index Toggle Pages: 1
Motion trails (Read 2838 times)
Motion trails
Oct 13th, 2008, 3:05am
 
Hi All

I've been having a tinker with my webcam and have produced a piece that records motion in the form of trails of coloured cicles. This allows the participant to "paint" using their bodies and any objects around them.

Have a look at some footage and/or get the source code at http://jamesalliban.wordpress.com/2008/10/13/motion-trails-v01/

Cheers

Jim
Re: Motion trails
Reply #1 - Oct 14th, 2008, 9:51pm
 
lovely idea.  source works great.  
Maybe you could fade them out over time. or make the fade also dependant on the amount of movement etc.
Re: Motion trails
Reply #2 - Oct 15th, 2008, 11:02am
 
Thanks for the comments/suggestions introspector. I tried to fade them out by adding a new rect every frame (or whenever there is movement):

fill(255, 3);
rect(0, 0, width, height);  

This faded up to a point but you could still see the circles. Here is an example:

http://jamesalliban.co.uk/blogContent/image/motionTest.jpg

I've had this problem before on previous projects and had to up the opacity. This solution wouldn't work here. Anyone know a way round this?

EDIT: One thing I can't do is keep references to each circle and redraw them with adifferent opacity each time as there are so many and the sketch is already straining my system enough as it is. Any suggestions on how to optimise the code would be very useful btw.
Re: Motion trails
Reply #3 - Oct 15th, 2008, 11:29am
 
i had the same problem with some sketches. there is some explanation in the hacks section:

http://processing.org/hacks/doku.php?id=hacks:fading

on the bottom of the page there is a link to a working solution:
http://www.tom-carden.co.uk/p5/fade2anycolour/applet/

Re: Motion trails
Reply #4 - Nov 2nd, 2008, 9:26pm
 
I'm liking this. Really beautiful effect. Haven't looked at your code, but have you thought about making the speed at which the screen updates variable? Or is that webcam dependant?

Right now it seems perfect for slow movements; if you move your face from left to right, it takes 5-10 seconds before you can start to see a face. It gets real blurry when you up your movement speed.
Re: Motion trails
Reply #5 - Nov 5th, 2008, 11:48pm
 
Thanks. In terms of framerate, it runs quite slowly even on a fairly powerful computer. I'm sure the code could be optimised but I've tried several approaches and the current one is the fastest.

@introspector. Thanks for the link. I integrated a slightly different approach into the sketch. The following is called every frame:

void fadescr() {
 loadPixels();
 for (int i = 0; i < pixels.length; i++) {
   int currR = (pixels[i] >> 16) & 0xFF; // Like red(), but faster
   int currG = (pixels[i] >> 8) & 0xFF;
   int currB = pixels[i] & 0xFF;
   pixels[i] = color(currR + 5, currG + 5, currB + 5);
 }
 updatePixels();
}
Re: Motion trails
Reply #6 - Nov 30th, 2008, 6:26am
 
Thanks for a great script. I was able to tinker with it and make a few changes, and make this video: http://www.vimeo.com/2382875
Re: Motion trails
Reply #7 - Jan 8th, 2009, 2:00pm
 
This is fantastic! Thanks so much for this.
Page Index Toggle Pages: 1