Raspberry Pi Photo booth (PiCamera v2)
(after setup and prep for auto launch, see sections below)
- $
booth - open new terminal window (Ctrl + Shift + N)
- $
opb
- begin setup on raspberry pi
- add Apache and PHP $
sudo apt-get install apache2 php7.0 php7.0-opcache - setup PHP to have default directory be
./wwwin this repo (see insturctions below: "Setup Default PHP Directory") - **** I'm sure something will go here too ****
- $
cd virtualenv && virtualenv -p python3 env --no-site-packagesto prep all dependencies in project - start virtual environment $
cd ../ && source virtualenv/env/bin/activate(see: http://sourabhbajaj.com/mac-setup/Python/virtualenv.html) - If setting up rPi, be ready to get some coffee. This next step takes a bit to install. (~15mins)
- go fetch all python dependencies $
pip install -r virtualenv/requirements.txt - setup picamera $
sudo apt-get install python3-setuptools && easy_install3 --user picamera(see: https://media.readthedocs.org/pdf/picamera/release-0.8/picamera.pdf)
See below about how to automate this
- $
cd wip/photo-booth/ && source virtualenv/envpi2/bin/activate - $
cd www/ && php -S localhost:8000 - open chrome with url:
localhost:8000
source: https://stackoverflow.com/a/23175981/3979495
- edit
apache2.conffile $sudo nano /etc/apache2/apache2.conf - edit
<Directory /var/www/html>to be<Directory /home/pi/wip/photo-booth/www> - edit
000-default.conffile $sudo nano /etc/apache2/sites-avilable/000-default.conf - edit
/var/www/htmlto be/home/pi/wip/photo-booth/www - restart apache $
sudo service apache2 restart - open chrome and go to url:
localhost
source: http://blog.startingelectronics.com/auto-start-a-desktop-application-on-the-rapberry-pi/
- create bash alias:
apb - $
echo "alias apb='. /home/pi/wip/photo-booth/virtualenv/envpi2/bin/activate'" >> ~/.bashrc - create bash alias:
opb - $
echo "alias opb='chromium-browser --kiosk http://localhost'" >> ~/.bashrc - $
echo "alias booth='apb && opb'" >> ~/.bashrc - Okay, now let's make it where terminal opens on boot and
boothget called #magic - make directory for startup $
mkdir -p .config/lxsession/LXDE-pi - edit startup $
echo"@lxterminal" >> .config/lxsession/LXDE-pi/autostart - add booth alias to start on terminal load
- $
echo "booth" >> ~/.bashrc - now try a reboot
- find pi if needed: $
sudo nmap -sP 10.10.1.1/24 - $
ssh pi@10.10.1.199 - $
sshfs pi@10.10.1.199:~/wip/photo-booth/ pi
- connect mac to pi file system for editing (see: https://www.raspberrypi.org/documentation/remote-access/ssh/sshfs.md)
- stop virtual environment $
deactivate - freeze new dependencies while virtual environment is active (see setup #3) in
virtualenv/env/folder $pip freeze --local > ../requirements.txt - camera interface settings will Disable if camera ribbon isn't plugged into port (Enable again and restart with camera plugged in)
- docs - http://sourabhbajaj.com/mac-setup/Python/virtualenv.html
- https://www.youtube.com/watch?v=VgP0xzLeLgA
- virtualenv, pip freeze, pip install >> https://www.youtube.com/watch?v=N5vscPTWKOk
- moving to Docker >> https://www.youtube.com/watch?v=ETL-_W1W8gY
- take picture
- overlay PNG onto pictures taken
- take 4 photos and make a gif
- collect user data into CSV, before taking photo
- store user data, photo file names, uuid, and if sent/emailed/shared
- create loop to start the next person
- validate data from user
- logic for if photoshoot.csv doesn't exist or camera module doesn't work
- add GUI (maybe Tkinter, appJar, or PyQt) (also see: http://appjar.info/ or https://github.com/cztomczak/cefpython)
- add visual countdown until camera captures photo
- add visual countdown for each photo being taken (when making a gif)
- resize images so gif is smaller in weight (see: http://picamera.readthedocs.io/en/release-1.10/api_camera.html#picamera.camera.PiCamera.capture)
- show resulting gif after gif created (start photobooth over after 10 seconds)
- send/batch social share and/or email the user a copy of photo/gif (see: https://www.raspberrypi.org/learning/tweeting-babbage/worksheet/)
- add overlay to preview (see: http://picamera.readthedocs.io/en/release-1.10/api_camera.html#picamera.camera.PiCamera.add_overlay)
- remove excess photos?? (9 total assets per instance)
- create slideshow of local
./camera-shots/