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
saveFrame() saves buffer? (Read 313 times)
saveFrame() saves buffer?
Apr 29th, 2008, 6:59am
 
Please excuse my ignorance, I'm very new here.

What I'm trying to achieve is very simple. Update a webcam feed for only pixels that have a luminance value above a given threshold. It looks exactly how I expect when I rut it. But the problem is when I write to disk using saveFrame. It seems to save only what is in the Buffer. Any ideas? Thanks in advance.


import processing.video.*;
Capture myCapture;

void setup()
{
 size(640, 480);
 colorMode(RGB, 1.0);
 myCapture = new Capture(this, width, height, 24);
}

 void captureEvent(Capture myCapture) {
 myCapture.read();
}

void draw() {

image(myCapture, 0, 0);
int[] newPixels = new int[width*height];
loadPixels();

for (int i = 0; i < height*width; i++) {
 if (brightness(pixels[i]) > 0.50) {
   newPixels[i] = pixels[i];
   }
}

arraycopy(newPixels, pixels);
updatePixels();
}

void keyPressed() {  
 saveFrame("renders/test-####.tif");  
}
Page Index Toggle Pages: 1