Close

Project Log 1

A project log for Raspberry Pi Photobooth

A homemade photobooth based on a raspberry pi.

guyisitGuyisIT 07/17/2015 at 23:130 Comments

OK, so PL1- the log where I start talking about the Raspberry Pi, python code, and bread boarding. I should state now that despite python being super easy to work with and use, I did need lots of help getting to a working product. I mention those who helped below.

Physically, my build was initially (and still is, I suppose) a shameless copy of Scott A. Fay's RPi photobooth wiring setup. In addition to the bread board setup, knowing the Canon SELPY would work with CUPS was important, as the photo printer was the biggest expense in this project. Below is the version 1 of my replica, with only a single 'ready' LED. (Ignore the microcontroller on the breadboard- it does nothing with this build.)

Now the photobooth setup has 3 buttons (one for each option of photo), along with a relay that turns on the two flash bulbs. I have funny story about my moving from bread board to protoboard, but I'll save that for project log 3. ;-)

For the code side of things, John Croucher's photobooth.py was the corner stone of my code. While I didn't end up using pygame (partly because I got tired of trying to figure it out), seeing how CUPS and PIL should work was really handy.

My pictures come out of the camera at 1920x1080 by default (because I'm using the FMV preview, I assume? I don't really know why it's not 5MP stills- it works out though because it means less processing time is required for manipulation.) From there, I use PIL to rotate the photos if needed, then stitch them together on top of a 'background image' that also contains the boarder splash images. These are used to bring the image ratio to 3:2, matching the 4:6 photo paper I'm printing on.

I need to give credit to Mad_man111 and ConcurrentHashMap credit for figuring out how to take a series of photos. I use this, along with time.sleep calls, to snap four photos to four constantly-rewritten temporary .jpgs.

def take_pictures():
    with picamera.PiCamera() as cam:
        counter = 0
        for each in range(4):
            counter = counter + 1
            cam.start_preview()
            if counter == 1: #length of preview time for first picture
                time.sleep(6)
            if counter > 1: #length of preview time for pictures 2-4
                time.sleep(3)
            cam.capture(imgPath + '/image' + str(counter) + '.jpg')
            cam.stop_preview()

Discussions