We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I was watching this video: 10.4 Brightness Mirror - p5.js Tutorial
and I am not getting my code to work:
var video;
function setup() {
createCanvas(320, 240);
pixelDensity(1);
video = createCapture(VIDEO).size(320, 240);
}
function draw() {
background(51);
video.loadPixels();
//pixels from canvas
loadPixels();
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++) {
var index = (x + y * width)*4;
pixels[index+0] = video.pixels[index+0];
pixels[index+1] = video.pixels[index+1];
pixels[index+2] = video.pixels[index+2];
pixels[index+3] = 255;
}
}
updatePixels();
}
It shows like a ghost-like video :/ http://xxnotmuchxx.tumblr.com/post/160811589716