Basic Brightness Tracking
import processing.video.*;
Capture camera;
void setup()
{
size(640, 480);
println(Capture.list());
camera = new Capture(this, 80, 60, 12);
}
void captureEvent(Capture camera)
{
camera.read();
}
void draw()
{
//image (camera,0,0,640,480);
// go through the image, hunt for bright pixels
// draw a red circle around them.
stroke(255,0,0);
noFill();
float r,g,b;
int x,y,x2,y2;
color c;
float bright;
background(255);
for (y=0;y<camera.height;y++)
{
for (x=0;x<camera.width;x++)
{
// get current color of this pixel
c=camera.get(x,y);
bright = brightness(c);
if (bright > 220)
{
ellipse(x*8,y*8,10,10);
}
}
}
}