Lo más cercano que he logrado a lo que quiero se ve así:

Aquí el código:
import processing.video.*;
color black = color(0);
color white = color(255);
int numPixels;
Capture cam;
void setup() {
size(320, 240);
strokeWeight(5);
cam = new Capture(this, width, height, 24);
numPixels = cam.width * cam.height;
noCursor();
smooth();
cam.frameRate(12);
}
void draw(){
if(cam.available()){
cam.read();
int threshold= 127;
float pixelBrightness;
loadPixels();
for(int i = 0;i < numPixels; i++){
pixelBrightness = brightness(cam.pixels[i]);
if (pixelBrightness > threshold){
pixels[i] = white;
}
else {
pixels[i] = black;
}
}
updatePixels();
int testValue = get(mouseX, mouseY);
float testBrightness = brightness(testValue);
if (testBrightness > threshold) {
fill(black);
} else {
fill(white);
};
PImage Img = loadImage(
"true.png");
cam.mask(Img);
image(cam,0,0);
}
}
No hay comentarios:
Publicar un comentario