xxxxxxxxxx
42
let capture;
let pix;
function preload(){
capture = createCapture(VIDEO);
}
function setup() {
createCanvas(windowWidth, windowHeight);
capture.size(1280, 720);
capture.hide();
}
function draw() {
//background(255);
//image(capture, 0, 0, 320, 240);
capture.loadPixels();
let x = int(random(capture.width));
let y = int(random(capture.height));
let pix = capture.get(x, y);
//float value = brightness (pix);
//let i = round( map (value, 0, 255, 0, 700*700-1) );
//color c2 = capture.pixels[i];
noStroke();
fill(pix, 128);
rect(x, y, random(5,20), random(5,20));
capture.updatePixels();
}
/*
let x = floor(random(0, capture.width));
let y = floor(random(capture.height));
let pix = capture.get(x, y);
fill(pix, 128);
ellipse(x, y, pointillize, pointillize);
*/