import processing.video.*;
float radious = 8;
Capture camera;
void setup(){
size(640, 480);
camera = new Capture(this, width, height);
camera.start();
}
void draw(){
background(255);
camera.loadPixels();
fill(0);
for(int x = 0; x < width; x += radious){
for(int y = 0; y < height; y += radious){
color c = camera.pixels[y * width + x];
float gray = 0.30 * red(c) + 0.59 * green(c) + 0.11 * blue(c);
if(gray < map(mouseX, 0, height, 0, 255)){
ellipse(radious / 2 + x, radious / 2 + y, radious * 0.8, radious * 0.8);
}
}
}
}
void captureEvent(Capture camera){
camera.read();
}