So i'm trying to create an interactive photobooth where it will access your camera to save pictures then super-impose pictures taken on top of your video feed. I'm actually running into a couple problems so i'll try and seperate them:
- The first problem I'm running in to is that i have to keep opening my patch, saving photos then having to restart my patch for processing to recognize the new photos.
- Another issue that i'm having is that when i try and create additional images to overlay, it will only recognize one at a time. For instance, i'll load and place images "img / img3 / img4" but when i load them on my patch - they will only place the most recent one.
I realize that this patch requires a webcam to operate, so I appreciate any help.
Thanks!
import processing.video.*; // import your dependancy
Capture cam; // declare your capture variable
boolean flash = false;
PImage img, img3, img4, maskImg;
void setup() {
size(1000, 800);
cam = new Capture(this, width, height, 30); // 'cam' = create a new capture event
background(255);
img = loadImage("image1.0.jpg");
maskImg = loadImage ("image2.0.jpg");
img3 = loadImage("image3.0.jpg");
maskImg = loadImage ("image3.0.jpg");
img4 = loadImage("image4.0.jpg");
maskImg = loadImage ("image4.0.jpg");
img.mask(maskImg);
img3.mask(maskImg);
img4.mask(maskImg);
}
void captureEvent(Capture cam) { // called when a new camera frame is available
cam.read(); // reads the frame that is captured ^^
}
void draw() {
image(cam, 0, 0); // displays the visual data via the cam
if (key == 'r') {
image(img, 0, 0);
image(img, width/4,0);
image(img3, 0, 0);
image(img3, width/2,0);
image(img4, width*2, 0);
image(img4, width/3,0);
}
}
float saveincr;
void keyPressed() { // press 'space' to save image.jpg
if (key == ' ') {
saveincr++;
save("data/" + "image"+saveincr+".jpg");
flash = true; //flash the screen so you can tell a photo is being taken