Sean McIntyre · designing technology to create art

Fluxtime Photobooth

Last year, Reid and I set up a photobooth at the Flux Factory 2013 Benefit using our Rainbow Machine technology. This year, Jason, Reid, and I made a photobooth for the 2014 edition of the event that built on the idea we started playing with last month. Flux Factory is such a great organization, it was an honor participate yet again.

The animated GIFs were made using three Rebel T3i cameras hooked up to Raspberry Pis to simultaneously take photos and process them. The GIFs were ready in less than 10 seconds from the photo being taken. Below I've outlined how that was done below, but first here are some of my favorite images from the night!

gif

gif

gif

gif

gif

The Setup and Code

Each camera was tethered to a Raspberry Pi running a simple Flask web server. I exposed two routes in the web server: preview, which simply returns the digital view finder image of the camera; and snap, which invokes the shutter and returns the image from the camera.

To control the cameras this way, I used libgphoto2 bindings exposed in python by piggyphoto. It is remarkably simple to control the Canon T3i's that Reid provided.

from flask import Flask, send_file
import piggyphoto
app = Flask(__name__)

image = 'photo.jpg'

@app.route("/preview")
def preview():
    C.capture_preview(image)
    return send_file(image)

@app.route("/snap")
def snap():
    C.capture_image(image)
    return send_file(image)

if __name__ == "__main__":
    C = piggyphoto.camera()
    C.leave_locked()
    C.capture_preview(image)
    app.run(host='0.0.0.0')

I made the Raspberry Pis run the Flask webserver on boot using crontab, which made it easy to reset the software if ever there was an issue.

Each Raspberry Pi was connected to a wifi router so they were on the same LAN. The master computer that the photographer used to take the photo was wirelessly connected to the same LAN.

Setup photos courtesy of Nick Normal, #smudgefilter

To take a photo, a simple bash script was run to curl each camera (more-or-less simultaneously, room for improvement possible -- but not sure if it's worth it), convert the images to GIFs, and make an animated GIF using gifsicle. I ran this script on an Apple laptop running OS X 10.9.

#!/bin/bash

# Define all the variables in advance
RASPBERRY_PI_1=192.168.77.200
RASPBERRY_PI_2=192.168.77.146
RASPBERRY_PI_3=192.168.77.230

TIME=$(date +%s)

RPI_IMAGE_1=stills/image_${TIME}_1.jpg
RPI_IMAGE_2=stills/image_${TIME}_2.jpg
RPI_IMAGE_3=stills/image_${TIME}_3.jpg

RPI_GIF_1=stills/image_${TIME}_1.gif
RPI_GIF_2=stills/image_${TIME}_2.gif
RPI_GIF_3=stills/image_${TIME}_3.gif

OUTPUT=gifs/gif_$TIME.gif

# Grab the images "concurrently"
curl -o $RPI_IMAGE_1 http://$RASPBERRY_PI_1:5000/snap &
curl -o $RPI_IMAGE_2 http://$RASPBERRY_PI_2:5000/snap &
curl -o $RPI_IMAGE_3 http://$RASPBERRY_PI_3:5000/snap &

# Wait the time it takes to transmit the images
echo "developing..."
sleep 4

# Convert the JPGs to GIFs for gifsicle
sips -Z 1024 -s format gif $RPI_IMAGE_1 --out $RPI_GIF_1
sips -Z 1024 -s format gif $RPI_IMAGE_2 --out $RPI_GIF_2
sips -Z 1024 -s format gif $RPI_IMAGE_3 --out $RPI_GIF_3

# Stitch together the GIFs to make them animated
gifsicle --delay=24 --loop $RPI_GIF_1 --delay=12 $RPI_GIF_2 --delay=24 $RPI_GIF_3 --delay=12 $RPI_GIF_2 > $OUTPUT

echo $OUTPUT

The animated GIF result was sent over to a viewing computer using scp that ran a PHP gallery script Jason hacked together, so that within 10 seconds the animated GIF photo result was viewable. This quick turnaround time is crucial for keeping your customers happy!

That's it! Sounds easy, but there was a lot of moving parts in play to make this work. Each Raspberry Pi has three cables coming out of it (Ethernet, power, and USB) and we used two power strips worth of plugs to keep everything running. At one point a Raspberry Pi stopped booting, but I was lucky enough to have an extra SD card with a freshly flashed version of Raspbian on it, phew!

The lighting, backdrop, and focal point of the shots were well-considered. The balloons were a great addition from Jason to have something fun for the participants to do while having their photo taken. During operation, the batteries in cameras needed to be swapped and camera settings needed to be tuned to get great results.

Having a good team to work with was probably the most key feature of making this photobooth succesful!

Below are some more of my favourite photos from the evening. The entire set can be found here.

More Photos

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

gif

comments powered by Disqus