xxxxxxxxxx
35
let cam;
let but;
function setup() {
createCanvas(400, 400);
pixelDensity(1);
cam = createCapture(VIDEO);
cam.hide();
noStroke();
but = createSlider(0, 120, 23)
}
function draw() {
// background(22, 150, 22,0);
noStroke()
//image(cam, 0, 0);
cam.loadPixels();
for(let x = 0; x < cam.width; x+=10) {
for(let y = 0; y < cam.height; y+=10) {
let colorFromVideo = cam.get(x,y);
let b = brightness(colorFromVideo);
if(b > 50) fill('white')
else fill('black');
ellipse(x, y, but.value(), but.value());
}
}
}