xxxxxxxxxx
49
let cam;
let x,y;
let a;
function setup() {
createCanvas(640, 480);
cam = createCapture(VIDEO);
cam.hide();
}
function draw() {
background(220);
cam.loadPixels();
//image(cam, 0, 0);
for (let y = 0; y < height; y++) {
for(i=0;i<640;i++);{
for(j=0;j<480;j++){
let index=i*4;
r= cam.pixels[index]
g= cam.pixels[index+1]
b=cam.pixels[index+2]
a=cam.pixels[index+3]
}
}
// for(let x=0; x<width; x+10){
// stroke(r,g,b,a);
// strokeWeight(5);
// point(x,y);
// }
stroke(r,g,b,a);
strokeWeight(50);
point(320,y);
stroke(r);
strokeWeight(50);
point(100,y);
stroke(g);
strokeWeight(50);
point(400,y);
stroke(b);
strokeWeight(50);
point(50,y);
}
}