posts tagged with the keyword ‘photobooth’

2015.11.17

Simple Photobooth

It’s become a tradition around here to update my simple photo booth using Processing when a new version of Processing comes out. I’m not sure Processing 3.x is final yet, but I’m using it, and it’s got all sorts of good stuff. (You probably remember Processing PhotoBooth v2 and Processing PhotoBooth, which are both deprecated now, but see them to know what I’m talking about.)

One of the things new in Processing is the fullScreen() function, which gets rid of the whole “figure out the size of the display” issue, by just saying “run at full screen”!

There’s also a new thing called settings() which can appear before setup(), but I won’t get into that…

Here’s some code!

/**
 * PhotoBoothV3.pde
 */
 
import processing.video.*;
Capture cam;

void settings() {
  fullScreen();
}

void setup() {
  colorMode(RGB);
  String[] cameras = Capture.list();
  if (cameras.length == 0) {
    exit();
  } else {
    cam = new Capture(this, cameras[0]);
    cam.start();
  }   
  noSmooth();
  background(0);
}

void draw() {
  if (cam.available()) {
    cam.read();
    image(cam, 0, 0);
  }
} 

void keyPressed() {
    if (key == ' ') {  // space bar
       saveFrame("Picture-######.jpg");
    }
}

And hey, once again you’ve got a simplistic photo booth application. Congratulate yourself by purchasing this lovely button for it. (Or get this “bare” button and build your own damn case.)

Now, I don’t know if the fullScreen() thing has a bug, or if it’s my setup, but here’s what I’m seeing. I typically run my display at 1440×900 using QuickRes, which is a non-standard setup. When I ran the sketch it seemed to display at 1280×720 in the upper-left corner. My guess is that the camera is only capturing 1280×720, so the sketch only fills that amount of the display, no matter what the resolution is. I’ve tested it at higher resolutions and get the same thing. If I set the display to 1280×800 it’s all good.

This is most likely not a bug, but a “thing to be aware of” in the future…

Besides all that, the most exciting thing about Processing lately is that there is finally an official version that runs on the Raspberry Pi! This is super-awesome and has great potential for artists and others who do exhibits and installations. I’ve already got a few ideas in the works. ;)

2012.11.15

Simple Photobooth

If you saw my old post about a simplistic photo booth using Processing, you probably loved it so much that you used it, and you probably loved using Processing so much that you used that too, and you even installed the betas of Processing 2.0, and then you cursed out loud as the code no longer worked.

Calm down, sport… we’re here to help.

While not final yet, Processing 2.0 has a lot of changes compared to Processing 1.5.x, and those of us who dabble in writing sketches can expect some breakage, but we can also attempt some fixage.

Here’s what I’ve got now… which works for me! (YMMV)

/**
 * PhotoBoothV2.pde
 */
 
import processing.video.*;

// resolution: 800x600 - change it if you want
int cols = 800;
int rows = 600; 

Capture cam;

int mainwidth  = cols;
int mainheight = rows;

void setup() {
  frameRate(30);
  size(mainwidth, mainheight, JAVA2D);
  colorMode(RGB);
  cam = new Capture(this, cols, rows); 
  cam.start(); 
  noSmooth();
  background(0);
}

void draw() {
  if (cam.available()) {
    cam.read();
    image(cam, 0, 0);
  }
} 

void keyPressed() {
    if (key == ' ') {  // space bar
       saveFrame("picture-####.jpg");
    }
}

Boom! You got a simplistic photo booth application. Congratulate yourself by purchasing this lovely button for it. (Or get this “bare” button and build your own damn case.)

Also, special thanks to Evil Mad Scientist for releasing their Atkinson Dithering sketch, which reminded me I had to fix my Processing code, and provided some hints on what needed updating.

2012.07.12

Dropping this here so I remember and so I can point people her if needed…

Sparkboth - View Settings

In Sparkbooth (v3) you can change the text that appears on screen. For instance you can change the word “spacebar” to “button” if you need to.

Sparkbooth Settings

Once you click the settings icon, go under General to On-Screen Messages.

Sparkbooth - Push The Button

Change what you want to change… Done!

2012.04.11

Photo Booth Tips

The fine folks over at Sparkbooth have this great Setup Checklist, and if you plan on setting up a photo booth at an event, it’s required reading…

I’m going to comment on a few items, as well as add a few things to the list, based on my personal experience.

Place a computer, webcam, and keyboard on a table in a well-lighted area. Don’t forget a chair or stool.

For my photo booth I ended up building a stand that puts the business end up about the height for a “typical adult human being” which happens to be my height! Since I use an iMac you can actually just tilt the monitor (and camera) up or down a bit if needed. This may not be clear to everyone, so a sign might also be helpful.

The part about a chair or stool is good advice if you want people to sit when they use the booth, which is a good idea because it puts people of different size close to the same height, which doesn’t happen as much when standing.

When considering location, don’t forget about extension cords! You never know how far you might be from an outlet. I actually have a power strip hidden in the back of my stand, which allows me to plug in the computer and light(s) and also gives me a place to hide the keyboard. From the power strip I can then run one extension cord to the nearest (or most out of the way) outlet. I bought a new extension cord since most of my old ones are filthy. Clean is better when it comes to appearance. You can also get white, or black, or something besides orange if desired.

For you computer… turn off instant messaging, email, and other applications, etc.

Do everything listed there. I actually go a few step beyond that, and on the Mac I use I created a completely separate account. I keep the account very minimal. It’s set to log into that user automatically, and launch Sparkbooth on startup. I’ve also got just Sparkbooth and Safari in the dock, as well as a shortcut for the folder where the images get saved. The idea is that when I turn it on, it’ll be completely ready to go in just a few minutes. I’ve also partitioned the drive into two halves, and once Sparkbooth was fully operational, I cloned the main partition to the second partition. This way if some update to the system breaks things, I can always revert to the last good working combo. (Between Mac OS X, Adobe AIR, etc. you never know what might go wrong.)

A few other things worth mentioning include signage. I also include instructions that tell people to push the button, and then get ready for 4 photos. (You be surprised how many people walk away after the first photo.) Lights, you should have them. Don’t depend on existing lighting, bring your own. As for a background, I don’t always use one myself, but I’d still recommend one if you can do it easily enough. (I’ve had my booth in some places that didn’t really allow for a background.)

As for the get a USB button suggestion, I’m obviously in favor of that one… and hey, you can even get one from my store or from Etsy. :)

2011.12.08

You probably know I’m a fan of Photo Booths, and while Sparkbooth is awesome software, you might want something free (and open source) so here’s “PhotoBooth” written in Processing.

This is all the code you need for the most minimal photo booth application:

/**
 * PhotoBooth.pde
 */ 
 
import processing.video.*;
Capture cam;

void setup() {
  size(1280, 720);
  cam = new Capture(this, 1280, 720);
}

void draw() {
  if (cam.available() == true) {
    cam.read();
    image(cam, 0, 0);
  }
} 

void keyPressed() {
    if (key == ' ') {  // space bar
      saveFrame("picture-####.jpg");
    }
}

Once you’ve got that, you can export it as an application from Processing.

(Note that I’m using a Logitech C910 webcam, so I’ve set the resolution to something that makes sense for that camera. If it looks weird with your camera, try 640×480 or something else.)

PhotoBooth Export Application

I generally use Mac OS X, but other operating systems are supported. This is one of the great things about Processing.

PhotoBooth Application

Over in the Finder you’ll see a standalone application named “PhotoBooth” that will run fullscreen when launched. (You can exit it by hitting the escape key.)

Spazz!

Once you launch it you’ll see some spazzy dude, wait, that’s me! You’ll probably see yourself instead.

Hit the space bar, and it’ll save a photo. Hit the space bar again and it’ll save another one. And on, and on.

PhotoBooth Photos

The photos will show up in the same folder as the application. They will have a random number in the name. It’s not sequential, but you can view by date created if you need them in order.

Here’s a more full version of the Processing code with a few extras commented out. Uncommenting them may prove useful for debugging or camera set-up.

/**
 * PhotoBooth.pde
 */ 
 
import processing.video.*;
Capture cam;

void setup() {
  size(1280, 720);

  // If no device is specified, will just use the default.
  cam = new Capture(this, 1280, 720);

  // To use another device (i.e. if the default device causes an error),  
  // list all available capture devices to the console to find your camera.
  //String[] devices = Capture.list();
  //println(devices);
  
  // Change devices[0] to the proper index for your camera.
  //cam = new Capture(this, width, height, devices[0]);

  // Opens the settings page for this capture device.
  //cam.settings();
}

void draw() {
  if (cam.available() == true) {
    cam.read();
    image(cam, 0, 0);
  }
} 

void keyPressed() {
    if (key == ' ') {  // space bar
      saveFrame("picture-####.jpg");
    }
}

And hey, I know that hitting the space bar ain’t cool… so you might want to use an awesome button instead.

This is a super-simple application, which basically takes some example code that ships with Processing and adds a bit to it. I hope to have a few more posts that talk about some changes you can make to this application. Stay tuned!

« Older Entries |


buy the button:

Buy The Button