LambdaBooth is an hardware and software modular and customizable photobooth that can make your parties even more funny.
These are the LambdaBooth functions:
- A person pushes a button (BUTTON).
- 5 seconds timer starts (COUNTDOWN).
- After the 5 seconds a photo is taken using a supported DSLR camera connected to the Raspberry and saved in a folder chosen by the user (CAMERA).
- The background of the photo is changed with a random background taken from a folder provided by the user using chromakey technique (CHROMAKEY).
- An overlay image (frame, watermark, logo, ...) is put on the photo (OVERLAY).
- The final photo is uploaded to a Google Photos album chosen by the user (GOOGLE_UPLOAD) and/or on a Facebook page album (FACEBOOK_UPLOAD). WARNING: Google and Facebook upload are intended for personal use only because in "configuration.yaml" file you have to insert also sensitive information.
- The final photo is also printed (PRINTING).
The user can switch on/off every function of the seven provided without any issue from the "enable/disable features" menu in the file "LambdaBooth.py":
## ENABLE/DISABLE FEATURES
BUTTON = 1 # use/don't use button
COUNTDOWN = 0 # use/don't use countdown
CAMERA = 1 # use/don't use camera
CHROMAKEY = 0 # use/don't use chromakey
OVERLAY = 1 # use/don't use overlay
GOOGLE_UPLOAD = 1 # use/don't use google photos upload
FACEBOOK_UPLOAD = 1 # use/don't use facebook upload
PRINTING = 0 # send/don't send the result to printer
and one can also configure every aspect from "configuration.yaml" file.
To make the complete version of Lambdabooth you need:
- A DSLR camera, please refer to this list to make sure your camera is supported. I've tested it with a Canon EOS 1100D
- A Raspberry Pi (more powerful it is and faster will be the elaboration)
- A cable to connect your camera to USB (please refer to your camera's manual)
- A micro USB Power Supply for Raspberry Pi
- A big momentary push button to take the photo such as this one
- A momentary button to switch on/off Raspberry Pi
- A 7 segment display for the countdown such as this one
- A well lit green screen such as this one
- Material for the LambdaBooth's box. You can use wood, plastic,...
- Electric cables for connections Obviously you can decide to don't use many things (such as the display) and make your own photobooth.
Every component needs its own dependecies to be satisfied. I've made a .sh file to install all the dependecies easily; you can run it with curl -s https://github.com/leobel96/LambdaBooth/installation.sh | bash
. Alternatively here there is a list for every component:
- Python 3 and pip3: If you have a recent version of Raspbian installed on your Raspberry Pi, they should already be installed.
- PyYAML: It is necessary to read the configuration file. Install it with
sudo pip3 install pyyaml
- gphoto2 and python-gphoto2: They are necessary for CAMERA. Installing them is as simple as:
sudo apt-get install gphoto2 libgphoto2*
followed bysudo pip3 install gphoto2
. - opencv3: It is necessary for CHROMAKEY and OVERLAY. I've compiled it myself, anyway this is a pretty hard and time consuming method (it requires many hours). Anyway you can also install it with
sudo pip3 install opencv-contrib-python
. - requests, flask, firefox: They are necessary for UPLOAD. Install them with:
sudo pip3 install --upgrade requests Flask
andsudo apt install firefox-esr
. - CUPS, pycups: They are necessary for PRINTING. Install the first one following this guide and the second one with
sudo apt-get install libcups2-dev --fix-missing
andsudo pip3 install pycups
.
- Clone all the repository in your Raspberry Pi and install the dependencies indicated in the previous chapter. IMPORTANT: You have to set Firefox as default browser to use UPLOAD because Chromium returns many errors.
- Edit parameters in "LambdaBooth.py" according to your needs.
- Create a folder for original photos, a folder for backgrounds and a folder for edited photos paying attention to edit their paths in
configuration.yaml
file. - Make/seek backgrounds and overlays(frames, logos, ...) with the same dimensions of the original photo (if you want to use CHROMAKEY or OVERLAY).
- Add the possibility to shutdown and power on the Raspberry Pi with a button adding
dtoverlay=gpio-shutdown,gpio_pin=3
to the file "/boot/config.txt" and connecting the button between GPIO3 (BCM) and GND. - Make "LambdaBooth.py" autostart at boot adding it to crontab following this guide.
- Connect the big fancy button you have bought to capture photo to one of the Rpi GPIO and edit the
configuration.yaml
file according to the pin you have chosen (BCM numeration). - Wire the 7 segment display as shown in this guide.
- If you want to upload your photos to Google photos or a Facebook page, follow Facebook API configuration and Google API configuration. For first time configuration you have to connect a monitor to raspberry to allow your Facebook and Google apps.
- If you want to print your photos, first install CUPS following this guide, then change the value of "printer_name" in
configuration.yaml
according to your printer's "Queue Name" in CUPS server. - After the installation and after you have tested that everything works as expected, I suggest you to disable the raspberry pi's GUI following these simple steps to reduce the GPU stress.
- Go to https://developers.facebook.com.
- Click on Get Started.
- Complete all the passages.
- Now you should be on your facebook app page. Click on
Facebook Login
and add tovalid OAuth redirect URI
:https://www.facebook.com/
- Click on "Settings" in the left column and "Base".
- Copy-paste the
App ID
andApp secret
in theconfiguration.yaml
file. - Now you can use your app to upload the images on a page YOU own. In particular find the
page_id
of your FB page following this easy guide and add it toconfiguration.yaml
file.
- Go to https://console.cloud.google.com/apis/library?pli=1
- Click on
Select project
from the top and, then,New project
. - Select the newly created project from the top.
- Search for
Photos Library API
. - Enable it.
- Go to
Credentials
menu fromAPIs & Services
on the left. Create credentials
,Oauth Client ID
- Click on
Configure consent screen
,Add scope
,Manually paste
, paste:https://www.googleapis.com/auth/photoslibrary
, click onADD
, select a name for the app and, thenSAVE
. - Repeat passages 6 and 7.
- Select
Application type
asother
andcreate
. - Now Copy-paste
client ID
andclient secret
in theconfiguration.yaml
file. - The first time you run "LambdaBooth.py" you will be asked to give access to your APP to your photos. Give the access and the program will do the rest.
I've taken a pretty hard green screen photo from google images to test the Chromakey feature. The result is pretty good:
Probably, editing parameters in chromakey function, you can achieve better results. Also edit them if you use a blue screen instead of a green one.
- After dependencies installation, I noticed errors when trying to import opencv module in Python. This is caused by other dependencies missing. In my case they were libatlas, libqt4 and libqt4-test. I've installed them in this way:
sudo apt-get install libatlas-base-dev libqt4 libqt4-test
. If you notice other errors caused by dependencies missing, please use Google to find a way to install them. - Running gphoto2, I kept having error 'Could not claim the USB device'. This was caused by two processes which keep camera busy. To fix it I've followed this guide. The problem was that, after reboot, the services keep autorun and I had to kill them after every boot. To kill them forever I used
sudo chmod -x /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
andsudo chmod -x /usr/lib/gvfs/gvfsd-gphoto2
. - For every problem related to opencv, gphoto2 or the other libraries used, please refer to their support page. In particular: gphoto2, opencv and python-gphoto2.
- Video Demonstration