First of all, I'd like to praise the versatility of Processing and how amazingly simple it is to quickly apply ideas and secondly I'd like to note that I'm completely new to it.
I'm currently working on a project in which multiple, time-delayed "shadows" are projected onto a canvas. The subject can dance in front of a camera and watch his shadows follow en suite behind him. I've included a crude mock-up and the simple code I've been working with.
My problem stems from the fact that everything black creates a "time-trail". Unfortunately the camera sees the projection as well and this creates a feedback loop (quite frustrating). Does anyone have any suggestions for eliminating this problem?
Thank you in advance,
stef
Original code by rrrufusss, modified by myself (depending on how light/dark it is in your room, you might want to change the THRESHOLD):
int inputFrame = 0; int outputFrame = 0; int output2Frame = 0; int output3Frame = 0; int frameWidth = 0; int frameHeight = 0;
/* parameters:
frames - the number of frames in the buffer (fps * duration) width - the width of the video height - the height of the video */ VideoBuffer( int frames, int width, int height ) { buffer = new PImage[frames]; for(int i = 0; i < frames; i++) { this.buffer[i] = new PImage(width, height); } this.inputFrame = frames - 1; this.outputFrame = frames -90; this.output2Frame = frames - 45; this.output3Frame = frames - 2; this.frameWidth = width; this.frameHeight = height; }
// return the current "playback" frame. PImage getFrame() { int frr;
// Add a new frame to the buffer. void addFrame( PImage frame ) { // copy the new frame into the buffer. System.arraycopy(frame.pixels, 0, this.buffer[this.inputFrame].pixels, 0, this.frameWidth * this.frameHeight);
// advance the input and output indexes this.inputFrame++; this.outputFrame++; this.output2Frame++; this.output3Frame++;