{"id":56,"date":"2016-03-28T17:09:09","date_gmt":"2016-03-28T16:09:09","guid":{"rendered":"http:\/\/eoghan.me.uk\/notes\/?p=56"},"modified":"2019-04-11T11:11:13","modified_gmt":"2019-04-11T10:11:13","slug":"photo-booth","status":"publish","type":"post","link":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/","title":{"rendered":"Raspberry Pi Photo Booth"},"content":{"rendered":"<p>Over the last year or so, we&#8217;ve been thinking of ways that we could use a Raspberry Pi at work, and looking for a project we could try it out with. One thought we had was a photo booth that staff and students could use to take portrait photos they could use for their <abbr title=\"Virtual Learning Environment\">VLE<\/abbr> profiles.<\/p>\n<p>Looking around the Net, I found <a href=\"http:\/\/www.drumminhands.com\/2014\/06\/15\/raspberry-pi-photo-booth\/\">Chris&#8217;s brilliantly detailed instructions<\/a> for a photo booth he built, listed at Drumminhands.com, and decided to have a go at adapting it for our use (and also borrow heavily from the structure of his instructions).<\/p>\n<p>The end result, mounted in a box created by our University joiners, looks like this:<\/p>\n<figure id=\"attachment_155\" aria-describedby=\"caption-attachment-155\" style=\"width: 225px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth.jpg\" rel=\"attachment wp-att-155\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-155\" src=\"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth-225x300.jpg\" alt=\"The finished photo booth\" width=\"225\" height=\"300\" srcset=\"https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth-225x300.jpg 225w, https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth.jpg 480w\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" \/><\/a><figcaption id=\"caption-attachment-155\" class=\"wp-caption-text\">The finished photo booth<\/figcaption><\/figure>\n<p><center><br \/>\n<a href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\" rel=\"license\"><img decoding=\"async\" style=\"border-width: 0;\" src=\"https:\/\/i.creativecommons.org\/l\/by-sa\/4.0\/88x31.png\" alt=\"Creative Commons Licence\" \/><\/a><br \/>\nRaspberry Pi Photo Booth by <a href=\"http:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/\" rel=\"cc:attributionURL\">Eoghan Clarkson<\/a> is licensed under a <a href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\" rel=\"license\">Creative Commons Attribution-ShareAlike 4.0 International License<\/a>.<\/center><br \/>\n<!--more--><\/p>\n<h2>The Plan<\/h2>\n<p>The main idea was to have an automated photo booth that staff and students could use to take profile photos. The booth would then resize the photos to the dimensions required by our various <abbr title=\"Virtual Learning Environment\">VLE<\/abbr>s, and provide the user with a personal web adress from where the photos could be downloaded.<\/p>\n<p>In addition, the photo booth could offer separate modes, such as one producing animated gifs that Chris&#8217;s photo booth provided.<\/p>\n<p>So the proceedure would be:<\/p>\n<ol>\n<li>Present the user with a main menu of options, initially:\n<ul>\n<li><strong>Official photo<\/strong><br \/>\n(the main mode, used for taking profile photos for <abbr title=\"Virtual Learning Environment\">VLE<\/abbr>s)<\/li>\n<li><strong>Accompanied photo<\/strong><br \/>\n(lets users take a photo with a local landmark superimposed on it)<\/li>\n<li><strong>Animated photo<\/strong><br \/>\n(takes four photos then builds them into an animated gif, as in the Drumminhands photo booth)<\/li>\n<li><strong>Continuous photos<\/strong><br \/>\n(continuously takes photos every couple of seconds, meant as a fun activity at events)<\/li>\n<\/ul>\n<\/li>\n<li>The user interface would consist of three buttons. The buttons would be illuminated to indicate when they are active, and on screen text would indicate each button&#8217;s function. On the main menu, the functions would be:\n<ul>\n<li>A button to move up the menu.<\/li>\n<li>A button to move down the menu.<\/li>\n<li>A button to select the current menu option.<\/li>\n<\/ul>\n<\/li>\n<li>A fourth button can be used to both shutdown the Pi (single press), or quit the photo booth application (hold down for a few seconds).<\/li>\n<\/ol>\n<p>The four modes would be:<\/p>\n<h3>Official photo<\/h3>\n<ol>\n<li>An overlay appears on-screen, to show user the area their head should fill.<\/li>\n<li>A couple of instruction screens appear.<\/li>\n<li>Four photos are taken at two second intervals.<\/li>\n<li>All four photos are presented on screen, together with options to &#8216;accept&#8217; or &#8216;reject&#8217; them.<\/li>\n<li>If the user accepts the photos, then:\n<ol style=\"list-style-type: lower-alpha;\">\n<li>They are resized into the various pre-defined sizes.<\/li>\n<li>They are uploaded to a web server.<\/li>\n<li>The web address for the images is shown on-screen.<\/li>\n<li>The user then presses a button to return to the main menu.<\/li>\n<\/ol>\n<\/li>\n<li>If the user rejects the photos, then return to the main menu.<\/li>\n<\/ol>\n<h3>Accompanied photo<\/h3>\n<ol style=\"list-style-type: lower-alpha;\">\n<li>An image appears on-screen (e.g. a statue) that the user can position themselves beside.<\/li>\n<li>Four photos are taken at two second intervals.<\/li>\n<li>All four photos are presented on screen, together with options to &#8216;accept&#8217; or &#8216;reject&#8217; them.<\/li>\n<li>If the user accepts the photos, then:\n<ol style=\"list-style-type: lower-alpha;\">\n<li>They are resized into a pre-defined size.<\/li>\n<li>They are uploaded to a web server.<\/li>\n<li>The web address for the images is shown on-screen.<\/li>\n<li>The user then presses a button to return to the main menu.<\/li>\n<\/ol>\n<\/li>\n<li>If the user rejects the photos, then return to the main menu.<\/li>\n<\/ol>\n<h3>Animated photo<\/h3>\n<ol style=\"list-style-type: lower-alpha;\">\n<li>Instructions appear on-screen.<\/li>\n<li>Four photos are taken at two second intervals.<\/li>\n<li>The photos are converted into an animated gif.<\/li>\n<li>The animated gif is displayed on the screen.<\/li>\n<li>The animated gif is uploaded to the server.<\/li>\n<li>The user can then:\n<ol style=\"list-style-type: lower-alpha;\">\n<li>Press &#8216;Start&#8217; to create another animated gif.<\/li>\n<li>Pres &#8216;Exit&#8217; to return to the main menu.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>(* I should have noticed Chris&#8217;s experiences with trying to display an animated gif on screen. Instead I tried myself &#8211; but ended up just repeatedly showing each individual jpeg photo in turn, as Chris did)<\/p>\n<h3>Continuous photo<\/h3>\n<ol>\n<li>Instructions appear on-screen, showing the web address where the photos will be available<\/li>\n<li>A photo is taken.<\/li>\n<li>The photo is uploaded to a web server.<\/li>\n<li>After two seconds, repeat from point 2 above.<\/li>\n<li>The user can press a button to leave continuous mode, and return to the main menu.<\/li>\n<\/ol>\n<h2>The parts<\/h2>\n<ul>\n<li>Raspberry Pi computer, I used a Pi 2B (<a href=\"http:\/\/uk.rs-online.com\/web\/p\/processor-microcontroller-development-kits\/8968660\/\">Raspberry Pi 3 Model B<\/a>, ~\u00a327)<\/li>\n<li>Micro SDHC card, with Micro SDHD to SD adapter (I got a <a href=\"http:\/\/www.dabs.com\/products\/v7-32gb-micro-sd-card-vamsdh32gcl10r-2e-BDMT.html\">32 GB Micro SDHC card, Class 10<\/a>, ~\u00a38; or <a href=\"https:\/\/www.7dayshop.com\/products\/kingston-micro-sd-sdhc-memory-card-45mb-s-class-10-32gb-WH2-SDC10G2\/32GBSP-10632\">save a couple of quid<\/a> if you&#8217;ve already got an adapter)<\/li>\n<li><a href=\"http:\/\/Raspberry Pi Official Universal Power Supply - 5V 2A\">Power adapter<\/a>, ~\u00a37 (but I&#8217;ve also used an old Samsung phone adapter I got from eBay)<\/li>\n<li>USB Keyboard and mouse.<\/li>\n<li><a href=\"http:\/\/www.modmypi.com\/raspberry-pi\/camera\/raspberry-pi-camera-board-5mp-1080p-v1.3\/\">Raspberry Pi camera module<\/a>, ~\u00a315<\/li>\n<li>Display screen (I used an old 15-inch DVI flatscreen)<\/li>\n<li>HDMI to DVI cable (I used a <a href=\"http:\/\/www.dabs.com\/products\/startech-com-0-5m-hdmi-to-dvi-d-cable---m-m-hddvimm50cm-9F5S.html\">0.5m HDMI to DVI-D Cable Male\/Male<\/a>, ~\u00a36.50)<\/li>\n<li>Buttons and cables:\n<ul>\n<li>Two of <a href=\"http:\/\/www.arcadeworlduk.com\/products\/High-Profile-60mm-Arcade-Button.html\">High Profile 60mm Illuminated Arcade Button<\/a>, 5V LED, in blue and green ~\u00a32 each<\/li>\n<li>One <a href=\"http:\/\/www.arcadeworlduk.com\/products\/Rectangular-Illuminated-Arcade-Button.html\">Rectangular Illuminated Arcade Button<\/a>, 5V LED, in red, ~\u00a31.50<\/li>\n<li>Button for shutdown, ~\u00a31 (I used a <a href=\"http:\/\/www.arcadeworlduk.com\/products\/Chen-Xiao-Button-Microswitch.html\">microswitch<\/a> because an order mixup gave me a spare, but should replace with a more suitable button)<\/li>\n<li>8 <a href=\"http:\/\/www.arcadeworlduk.com\/products\/10-x-1-metre-long-insulated-4-8mm-crimped-wires.html\">Insulated 4.8mm Crimped Wires<\/a> in various colours, ~\u00a33 for 10<\/li>\n<li>4 <a href=\"http:\/\/www.arcadeworlduk.com\/products\/10-x-1-metre-long-insulated-6-3mm-crimped-wires.html\">Insulated 6.3mm Crimped Wires<\/a>, ~\u00a33 for 10<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"http:\/\/www.modmypi.com\/raspberry-pi\/breakout-boards\/adafruit\/adafruit-perma-proto-hat-for-pi-mini-kit-no-eeprom\/\">Perma-Proto HAT<\/a>, ~\u00a35<\/li>\n<\/ul>\n<h3>Extras<\/h3>\n<ul>\n<li>Raspberry Pi 3 comes with built-in WiFi &#8211; but if you have an earlier model, then a Wireless USB adaptor can be handy (or just use an Ethernet cable)\n<ul>\n<li><a href=\"http:\/\/uk.rs-online.com\/web\/p\/wireless-adapters\/7603621\/\">Edimax 2.4 GHz USB 2.0 (EW-7811UN)<\/a> wireless adaptor, ~\u00a310.50<\/li>\n<li><del><a href=\"http:\/\/uk.rs-online.com\/web\/p\/wireless-adapters\/8651397\/\">Edimax 2.4\/5 GHz USB 2.0 (EW-7811UTC)<\/a> wireless adaptor, ~\u00a313.50<\/del> [Edit: I got the <a href=\"http:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/\">Edimax EW-7811UN working easily<\/a>, but had trouble with the EW-7811UTC].<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"http:\/\/www.modmypi.com\/raspberry-pi\/camera\/raspberry-pi-camera-board-replacement-cable-457mm\/\">Pi camera board extension cable<\/a> (457mm, ~\u00a32.50; or cheaper on eBay)<\/li>\n<li><a href=\"http:\/\/www.modmypi.com\/raspberry-pi\/camera\/pibow-camera-mount\/\">PiBow Camera Mount<\/a>, ~\u00a33<\/li>\n<li>Before getting the soldering iron out, I used a prototyping breadboard to work out the GPIO connections to use:\n<ul>\n<li><a href=\"http:\/\/www.maplin.co.uk\/p\/ad-01-solderless-breadboard-bz13p\">Prototyping breadboard<\/a>, ~\u00a38<\/li>\n<li><a href=\"http:\/\/www.maplin.co.uk\/p\/adafruit-t-cobbler-plus-for-raspberry-pi-a-b-pi-2-n67ea\">T-Cobbler<\/a> for breadboard, ~\u00a38<\/li>\n<li>A few <a href=\"http:\/\/www.maplin.co.uk\/p\/flexible-jumper-wire-50mm-flex75mm-overall-length-fs66w\">jump wires<\/a>, ~\u00a35<\/li>\n<\/ul>\n<\/li>\n<li>Polyester cable sheath (<a href=\"http:\/\/www.ebay.co.uk\/itm\/1m-15mm-Polyester-Cable-Cover-for-Sheath-Sheathing-Sleeve-Sleeving-Wiring-Wire-\/251271420056\">1m long, 15mm wide<\/a>), ~\u00a32<\/li>\n<\/ul>\n<h3>Finally<\/h3>\n<ul>\n<li>Create a directory on a web host, where the Raspberry Pi can upload its photos and make them available to the user. Note the FTP login details to place in the scripts.<\/li>\n<\/ul>\n<h2>Setting up the Raspberry Pi<\/h2>\n<p>I&#8217;ve put my standard set-up on the following page:<\/p>\n<ul>\n<li><a href=\"http:\/\/eoghan.me.uk\/notes\/2016\/04\/27\/setup-raspberry-pi\/\">Set Up Raspberry Pi<\/a><\/li>\n<\/ul>\n<h2>The Python code<\/h2>\n<h3>The Code<\/h3>\n<p>I used Python 2.x, which was the default on the Noobs install. The code is available on my <a href=\"https:\/\/github.com\/eoghan-c\/photobooth\">GitHub photobooth<\/a> project.<\/p>\n<p>The following code would copy the code into this directory:<\/p>\n<ul>\n<li>~\/Documents\/Python Projects\/photobooth<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true\">cd ~\/Documents\/\nmkdir \"Python Projects\"\ncd \"Python Projects\"\ngit clone https:\/\/github.com\/eoghan-c\/photobooth.git<\/pre>\n<p>The scripts create a temporary directory on the Pi to hold the images before uploading them, in:<\/p>\n<ul>\n<li>~\/photobooth<\/li>\n<\/ul>\n<h3>Editing from a Mac<\/h3>\n<p>It was much easier to use my Mac to edit the Pi&#8217;s python scripts, than to edit them on the Pi.<\/p>\n<p>I connected to the Pi in two ways:<\/p>\n<ol>\n<li>Launch the Terminal application on the Mac, and connect to the Pi&#8217;s IP address, e.g.:\n<pre class=\"lang:sh decode:true\">ssh pi@192.168.0.15\n<\/pre>\n<\/li>\n<li>Use the Mac&#8217;s Finder to mount the Pi&#8217;s volume:\n<ol>\n<li>Install Netatalk, using the Pi&#8217;s Terminal command (a one-time setup):\n<pre class=\"lang:sh decode:true \">sudo apt-get install netatalk\n<\/pre>\n<\/li>\n<li>From the Mac Finder&#8217;s &#8216;Go&#8217; menu, select &#8216;Connect to Server&#8230;&#8217;<\/li>\n<li>Enter the Server Address, e.g.:\n<pre class=\"lang:sh decode:true \">afp:\/\/192.168.0.15\n<\/pre>\n<\/li>\n<li>Click the &#8216;Connect&#8217; button.<\/li>\n<li>Enter your Pi&#8217;s username and password<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>The Pi then mounts as a normal volume, and you can edit the code in your favourite editor.<\/p>\n<h3>Modules to Install<\/h3>\n<p>Before you can run the code, make sure you install the following modules:<\/p>\n<p>Install the Python Imaging Library (PIL) &#8211; used for cropping and resizing images:<\/p>\n<pre class=\"lang:sh decode:true \">sudo apt-get install python-imaging\n<\/pre>\n<p>Install <a href=\"http:\/\/www.graphicsmagick.org\/\">GraphicsMagick<\/a> &#8211; used to create the animated GIFs:<\/p>\n<pre class=\"lang:sh decode:true \">sudo apt-get install graphicsmagick\n<\/pre>\n<h3>Customisable parts<\/h3>\n<h4>Photobooth_functions.py script, OfficialPhoto() function<\/h4>\n<p>The <em>self.image_defs<\/em> variable holds an array controlling the dimensions that &#8216;Official photos&#8217; are resized to.<\/p>\n<p>Each row of the array is in the form:<\/p>\n<ul>\n<li>Description, image width, image height, image DPI<\/li>\n<\/ul>\n<h4>HTML folder<\/h4>\n<p>The HTML folder contains the HTML templates which are uploaded to the server along with the photos, seen when the user goes to download the photos.<\/p>\n<h2>Hardware<\/h2>\n<h3>Variables in the Code<\/h3>\n<p>The variables defined for the hardware in <em>config.py<\/em> are (note in this project I used <a href=\"http:\/\/raspberrypi.stackexchange.com\/questions\/12966\/what-is-the-difference-between-board-and-bcm-for-gpio-pin-numbering\">GPIO.BCM<\/a> so the &#8216;GPIO PIN&#8217; column refers to the BCM numbers):<\/p>\n<table>\n<tbody>\n<tr>\n<th>Variable<\/th>\n<th>Description<\/th>\n<th>GPIO Pin<\/th>\n<\/tr>\n<tr>\n<td>led_pin_select<\/td>\n<td>The LED of the &#8216;Select&#8217; button<\/td>\n<td>GPIO 18<\/td>\n<\/tr>\n<tr>\n<td>button_pin_select<\/td>\n<td>The close terminal of the &#8216;Select&#8217; button&#8217;s microswitch<\/td>\n<td>GPIO 23<\/td>\n<\/tr>\n<tr>\n<td>led_pin_left<\/td>\n<td>The LED of the &#8216;Left&#8217; button<\/td>\n<td>GPIO 17<\/td>\n<\/tr>\n<tr>\n<td>button_pin_left<\/td>\n<td>The close terminal of the &#8216;Left&#8217; button&#8217;s microswitch<\/td>\n<td>GPIO 27<\/td>\n<\/tr>\n<tr>\n<td>led_pin_right<\/td>\n<td>The LED of the &#8216;Right&#8217; button<\/td>\n<td>GPIO 16<\/td>\n<\/tr>\n<tr>\n<td>button_pin_right<\/td>\n<td>The close terminal of the &#8216;Right&#8217; button&#8217;s microswitch<\/td>\n<td>GPIO 20<\/td>\n<\/tr>\n<tr>\n<td>button_pin_exit<\/td>\n<td>The close ternimal of the &#8216;Exit&#8217; button&#8217;s microswitch<\/td>\n<td>GPIO 5<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>The other terminals of the buttons and LEDs<\/td>\n<td>Ground<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Fritzing Diagram<\/h3>\n<p>The buttons I bought contained 5V LEDs, so I didn&#8217;t need to use diodes.<\/p>\n<figure id=\"attachment_160\" aria-describedby=\"caption-attachment-160\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/photobooth_bb_w640.jpg\" rel=\"attachment wp-att-160\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-160\" src=\"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/photobooth_bb_w640-300x287.jpg\" alt=\"Fitzing wiring diagram\" width=\"300\" height=\"287\" srcset=\"https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/photobooth_bb_w640-300x287.jpg 300w, https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/photobooth_bb_w640-313x300.jpg 313w, https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/photobooth_bb_w640.jpg 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-160\" class=\"wp-caption-text\">Fitzing wiring diagram<\/figcaption><\/figure>\n<p>You can also download the Fitzing wiring diagram.<\/p>\n<h3>Soldering<\/h3>\n<p>I worked out the wiring for the buttons and LEDs on a prototyping breadboard, together with the length of wires needed. Then soldered them into the perma-proto HAT (badly).<\/p>\n<figure id=\"attachment_158\" aria-describedby=\"caption-attachment-158\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/hat_w640.jpg\" rel=\"attachment wp-att-158\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-158\" src=\"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/hat_w640-300x225.jpg\" alt=\"Perma-Proto HAT soldering\" width=\"300\" height=\"225\" srcset=\"https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/hat_w640-300x225.jpg 300w, https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/hat_w640-400x300.jpg 400w, https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/hat_w640.jpg 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-158\" class=\"wp-caption-text\">Wiring soldered into the Perma-Proto HAT board<\/figcaption><\/figure>\n<h2>Auto-run the Python script<\/h2>\n<p>I used systemd, as detailed by Matt in <a href=\"http:\/\/www.raspberrypi-spy.co.uk\/2015\/10\/how-to-autorun-a-python-script-on-boot-using-systemd\/\">How To Autorun A Python Script On Boot Using systemd<\/a><\/p>\n<p>(though \u2018Type=simple\u2019 seemed to work for my script).<\/p>\n<p>I\u2019ve included the Unit file with the program files, and you can use it if you have installed the scripts into the directory I used):<\/p>\n<ol>\n<li>Copy the Unit file into the correct location by using:<\/li>\n<\/ol>\n<pre class=\"lang:sh decode:true\">sudo cp \"\/home\/pi\/Documents\/Python Projects\/photobooth\/photobooth.service\" \/lib\/systemd\/system\/\n<\/pre>\n<ol>\n<li>Then refresh the daemon with:<\/li>\n<\/ol>\n<pre class=\"lang:sh decode:true \">sudo\u00a0systemctl daemon-reload\n<\/pre>\n<ol>\n<li>And tell systemd to start the service during the boot sequence, with:<\/li>\n<\/ol>\n<pre class=\"lang:sh decode:true \">sudo systemctl enable photobooth.service\n<\/pre>\n<ol>\n<li>Reboot the Pi:<\/li>\n<\/ol>\n<pre class=\"lang:sh decode:true\">sudo shutdown -r now\n<\/pre>\n<ol>\n<li>And after rebooting, the Pi should automatically launch the blood_pressure scripts.<\/li>\n<\/ol>\n<p>The following commands are useful to get the status, or stop the service:<\/p>\n<pre class=\"lang:sh decode:true\">sudo systemctl status photobooth.service\nsudo systemctl stop photobooth.service\n<\/pre>\n<p>The above should create a Unit file at <em>\/lib\/systemd\/system\/blood_pressure.service<\/em> containing:<\/p>\n<pre class=\"lang:sh decode:true \">[Unit]\nDescription=A Photo Booth. Instructions at http:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/\nAfter=multi-user.target\n\n[Service]\nType=simple\nExecStart=\/usr\/bin\/python \"~\/Documents\/Python Projects\/blood_pressure\/main.py\"\nRestart=on-abort\nUser=root\n\n[Install]\nWantedBy=multi-user.target\n<\/pre>\n<h2>Improvements<\/h2>\n<h3>Camera Position<\/h3>\n<p>I put the camera module on top of the display screen &#8211; but, because the default camera module lens has a short focal length, you have to be close to the camera to fill the frame if you want a portrait photo. As the camera is placed on top of the screen, you then have to look up a bit awkwardly if you want to look into the camera.<\/p>\n<p>It would be good to find a lens for the camera module that could narrow the angle of view, and allow the user to sit further way from the camera.<\/p>\n<h3>Lighting<\/h3>\n<p>I bought an <a href=\"http:\/\/www.johnlewis.com\/john-lewis-leo-led-clip-light\/p151532\">LED Clip Light<\/a> (\u00a330) to stick on top of the flatscreen, that the user could switch on and off &#8211; but this doesn&#8217;t provide enough light. I think that Kevin Osborn&#8217;s idea to use <a href=\"http:\/\/baldwisdom.com\/open-hardware-summit-photobooth\/\">LED strips<\/a> as a flash might be worth a try.<\/p>\n<h3>Image Overlays<\/h3>\n<p>I displayed images on the screen using <a href=\"http:\/\/www.pygame.org\/docs\/ref\/surface.html\">pygame.Surface<\/a> with a surface alpha value &#8211; but this doesn&#8217;t allow different parts of the image to be displayed with different transparencies. So the overlay showing where to put your face in the &#8216;Official photo&#8217; mode isn&#8217;t completely transparent in the centre, and darkens the whole image.<\/p>\n<p>It may be better to try using per pixel alphas instead, although the documentation notes that this is the slowest drawing mode.<\/p>\n<p>Also, the some image overlays are optimised for the display screen size and shape, and might not display well on a different display screen.<\/p>\n<h3>Customisable Variables<\/h3>\n<p>Move all the main customisable variables into <em>config.py<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the last year or so, we&#8217;ve been thinking of ways that we could use a Raspberry Pi at work, and looking for a project we could try it out with. One thought we had was a photo booth that staff and students could use to take portrait photos they could use for their VLE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Raspberry Pi Photo Booth - Eoghan&#039;s Notes<\/title>\n<meta name=\"description\" content=\"We were interested in trying out a Raspberry Pi at work, and decided a photo booth would be an interesting and useful project to start with.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Raspberry Pi Photo Booth - Eoghan&#039;s Notes\" \/>\n<meta property=\"og:description\" content=\"We were interested in trying out a Raspberry Pi at work, and decided a photo booth would be an interesting and useful project to start with.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/\" \/>\n<meta property=\"og:site_name\" content=\"Eoghan&#039;s Notes\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-28T16:09:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-11T10:11:13+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth-225x300.jpg\" \/>\n<meta name=\"author\" content=\"Eoghan\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eoghan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/\",\"url\":\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/\",\"name\":\"Raspberry Pi Photo Booth - Eoghan&#039;s Notes\",\"isPartOf\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth-225x300.jpg\",\"datePublished\":\"2016-03-28T16:09:09+00:00\",\"dateModified\":\"2019-04-11T10:11:13+00:00\",\"author\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800\"},\"description\":\"We were interested in trying out a Raspberry Pi at work, and decided a photo booth would be an interesting and useful project to start with.\",\"breadcrumb\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#primaryimage\",\"url\":\"https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth.jpg\",\"contentUrl\":\"https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth.jpg\",\"width\":480,\"height\":640,\"caption\":\"The finished photo booth\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eoghan.me.uk\/notes\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Raspberry Pi Photo Booth\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#website\",\"url\":\"https:\/\/eoghan.me.uk\/notes\/\",\"name\":\"Eoghan&#039;s Notes\",\"description\":\"The odd note that might come in handy someday\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eoghan.me.uk\/notes\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800\",\"name\":\"Eoghan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g\",\"caption\":\"Eoghan\"},\"url\":\"https:\/\/eoghan.me.uk\/notes\/author\/eoghan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Raspberry Pi Photo Booth - Eoghan&#039;s Notes","description":"We were interested in trying out a Raspberry Pi at work, and decided a photo booth would be an interesting and useful project to start with.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/","og_locale":"en_GB","og_type":"article","og_title":"Raspberry Pi Photo Booth - Eoghan&#039;s Notes","og_description":"We were interested in trying out a Raspberry Pi at work, and decided a photo booth would be an interesting and useful project to start with.","og_url":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/","og_site_name":"Eoghan&#039;s Notes","article_published_time":"2016-03-28T16:09:09+00:00","article_modified_time":"2019-04-11T10:11:13+00:00","og_image":[{"url":"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth-225x300.jpg","type":"","width":"","height":""}],"author":"Eoghan","twitter_misc":{"Written by":"Eoghan","Estimated reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/","url":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/","name":"Raspberry Pi Photo Booth - Eoghan&#039;s Notes","isPartOf":{"@id":"https:\/\/eoghan.me.uk\/notes\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#primaryimage"},"image":{"@id":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#primaryimage"},"thumbnailUrl":"http:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth-225x300.jpg","datePublished":"2016-03-28T16:09:09+00:00","dateModified":"2019-04-11T10:11:13+00:00","author":{"@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800"},"description":"We were interested in trying out a Raspberry Pi at work, and decided a photo booth would be an interesting and useful project to start with.","breadcrumb":{"@id":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#primaryimage","url":"https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth.jpg","contentUrl":"https:\/\/eoghan.me.uk\/notes\/files\/2016\/03\/whole_photobooth.jpg","width":480,"height":640,"caption":"The finished photo booth"},{"@type":"BreadcrumbList","@id":"https:\/\/eoghan.me.uk\/notes\/2016\/03\/28\/photo-booth\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eoghan.me.uk\/notes\/"},{"@type":"ListItem","position":2,"name":"Raspberry Pi Photo Booth"}]},{"@type":"WebSite","@id":"https:\/\/eoghan.me.uk\/notes\/#website","url":"https:\/\/eoghan.me.uk\/notes\/","name":"Eoghan&#039;s Notes","description":"The odd note that might come in handy someday","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eoghan.me.uk\/notes\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800","name":"Eoghan","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g","caption":"Eoghan"},"url":"https:\/\/eoghan.me.uk\/notes\/author\/eoghan\/"}]}},"_links":{"self":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":101,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"predecessor-version":[{"id":468,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/56\/revisions\/468"}],"wp:attachment":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}