 This talk was already in the schedule of Easter egg and it was announced as being English But there were only German speakers in the room. So I figured I'd do it in German But even though there still seem to be only German speakers here, I'm still going to do it English So you're out of luck Just for I guess for the tape so that we have this in English Okay, anyway, so I'm Andreas or fractinas in the a Schaffenburg Hacker maker space Schaffenburg ev and I built a photo booth and This talk is gonna be about why and how and all of this First off what is such a thing? What is a photo booth? So? you probably remember the actual photo booth Cabin things in train stations or at the city hall where you could get passport photos printed they used to work with actual developing film and Of course now there are digital with digital cameras and digital printers and Yeah, they're still around just not as popular anymore and Of course nowadays the term booth refers to Devices that you don't necessarily have to climb into and you're encased in a little box but it's also for just the device that stands somewhere or hangs on a wall and Yeah, in Japan There are really popular devices called Purikra and it comes from print club and there are little Things that came up in the nine nineteen hundred and ninety five by one of the major Digital game manufacturers. I forgot which one Konami or something and You could basically take a picture of yourself and then you'd have a little Screen and you could put clip art on it and move it around and then print little stickers and they're still very popular in Japan so a Photo booth as I refer to or as it's generally referred to is a device that'll take a picture of you after a countdown usually and then you can preview yourself in the screen digitally decide whether you want to print it or not and They don't even necessarily have to have a printer sometimes they just capture the photos like on a Wedding or something and then they may go into a digital photo album Or of course nowadays You may want to upload them to Facebook or to any social network thing The popular things not so popular on events like this, but still And of course usually photos are saved on hard disk or SD card or not Yeah, and sometimes Funny props that you can use and disguise yourself or make yourself even prettier than you already are Yeah, typical use cases. I already mentioned weddings and of course birthday parties big corporate events or Congresses like this affairs So our motivation why why did we build such a device was? It's really fun to use so I was at a birthday party at a fortieth and We printed over 500 copies on that night with roughly hundred guests and it was really funny everybody had a great time and I wanted to to have that photo booth for for an event for a charity event Christopher Street Day in our Schaffenburg and Then I found out how much these things actually cost when you rent them. They're really expensive Goes up to like 1500 euro a day And I thought to myself well for that price we can probably build one ourselves out of used Used parts And so I decided yeah, why don't we just do that? Considering that on that date that photo booth wasn't available anymore anyway Yeah, and It turns out we can actually use it to make some money out of it because people pay Donations to get their photos printed and when we're on a public event on a fair or something Yeah, people have a lot of fun Taking pictures and then printing printing them having something as a souvenir to take home And we hand out our little flyer from our hacker space and they give us a donation for the prince so win-win situation and Of course when you start from scratch then you really have to plan it and you learn a lot It's the software. It's the hardware. It's the woodworking Bring it up bringing it all together like interdisciplinary Lee That was an a big nice project And it's ideal if you want to delegate it into different groups like one group does the software one group Does the Arduino or not? So our approach building that thing was first I wrote an experimental capture program so is it possible using a digital DSLR camera Not so much a webcam. That would be too easy a digital actual good camera Capture a preview image a live video and then capture the photos through USB with a little program So when that worked I decided yeah, let's go for a printer and We bought all the different parts plugged it together and then once that worked Build the cabinet the case Yeah, and then at the end added some effects and the flash and everything So about the software architecture So of course it had to be all free software. We didn't want to use proprietary camera Makers drivers. We didn't want to use windows or anything closed source so of course the base is Linux and then There's three main parts that I use three frameworks or libraries to build the photo booth application and first part is live G photo to and this is a an abstraction for basically every digital camera that there is like There's like 2000 or something supported more or less You have a pretty high-level API and you just tell it Take a camera or take a picture Download the picture take preview video and it does it all for you. You don't have to deal with separate camera drivers or manufacturing Or manufacturers specialties for the different USB whatnot So that makes it really easy, but it's also a little techier. It doesn't work perfectly yet You'll see later The documentation is not very Nice either. So it's pretty much non-existent. There are a few examples that you can use But it's now it's not so easy, but it's getting better. There's still working on it. So for example, this is a little sample command and what it'll what it'll do it'll just It'll just do what it pretty much says it'll take a picture and Download it as a file then I have it and then I can display that and Voila, this is a live picture from just now Pretty easy. It's just one command and it works with any camera pretty much So that was nice to have Going back to this The next big column I call it is G streamer and G streamer does everything that has to do with video processing and image processing in the photo booth software so G streamer is a General-purpose multimedia frame framework. It's pipeline based I'll go into that later What that means it's media agnostic, which means you can pretty much convert Everything into everything read everything. It can be a text file or any network stream So it supports everything and if it doesn't support it, then you just write a plug-in for it Yeah, there's countless plugins in three different categories like good, bad, ugly And it's super cool to use You should take a look at it Yeah, and for example, it allows you to if you capture a preview with the G photo That will Output an emotion JPEG stream so pretty much take one JPEG image after another and then send that to standard out and I can pipe that into G streamer with GST lounge Read it out with FD source that pretty much reads the standard out again standard in Decode bin is a magic element that will Find out what stream it is and then plug the necessary elements to decode that and auto video sync is The element that will show it on the screen and I'll just do that real quick That's this command I have this display equals zero because I'm working remotely so that the terminal knows that I want it on that screen and Yeah, this is the The live view can I? No Okay so the third part is glib and gtk plus that's the GUI framework that I used it's it's an old one that was originally created in 96 for GIMP so it's I Think it even stands for GIMP something so it's a it's a an acronym and Yeah, it gives you everything that you you may know from like qt or all the the widget systems toolkits you have buttons sliders and you have Below that you have an event-driven system that'll let you Take all that and turn it into a program. So below the gtk. There's g lip. That's also what G streamer is based on not lip g photo, even if even it's called G photo it doesn't use g lip And it's a it's a low-level core library that will pretty much bring an objected object oriented programming into ANSI see so you can use object oriented programming and you have threads and signals and everything that you expect from a modern system and Since G streamer uses that already I decided to just go And use that in the photo booth too and not qt or anything else. I was a question last time Um, yeah, there's a there's a builder software for for the g y and it's called glade and it's it's just a UX designer that I used Okay, so About the user interface of the software It's pretty easy Because it's meant to be used like by it by children or anyone just with a touchscreen It starts When you first start it up it loads the parses the any file loads a couple of options from it You can customize it extensively like you have a template for for the user interface you can replace and colorize all the widgets the buttons change the font the size and Of course an overlay image. This one still has the Easter egg overlay I made one for gpn now, of course and Yeah, the the safe paths and the template how the files that are safe should be named the countdown duration the strings for that should be displayed like the sage ease you could put any anything else in there translated for example and Settings for the sound like there's a beep during the countdown you could change that into anything and You can also have a background video that will play after a certain time I call it screensaver. It's more like a camera saver because the camera gets really warm during the live view and takes a lot of energy goes through the batteries real fast and and settings how many copies you want to allow max and minimum and the tokens for Social media upload like Facebook, Imgur Twitter Yeah, so you you start that up and then you set it somewhere and it'll go into the preview and People can see themselves on the screen when the when a camera is detected and it starts and by touching the screen countdown will start Counts down from six to zero and then take some picture and then you see The picture on the screen you can decide you want to print it Do you want to cancel and on with a slider? You can select how many prints you want? how many copies and Then once it's done printing You get another Button where you can upload it to Imgur or Facebook if you want it defaults to no upload So if you don't do anything, then it'll disappear and go back into preview after a moment Yeah There's also a little status bar status bar in the bottom that will tell you the dates and you can see if it's still working if Still counts the seconds and then on the on the right side. There's a status of the printer. How many? How many copies you can still make it's it's a big printer with a with a roll of paper that holds 600 copies and it'll count down so this is about the architecture of the application itself It has this is the main application context on the left side and there's a capture thread that is Yeah, that's pretty much controlling the LibG photo commands Which will read from the camera continuously read the Motion JPEG stream that I've mentioned and then hand that over to G streamer Which will display it decoded and display it and There's also the lead thread which is or a lead class which will Talk to the Arduino and make it all pretty colorful Just maybe go into this real quick so once the capture thread is started pretty much it'll do an in it and then it'll just keep capturing video and This invokes the capture preview command of LibG photo and then that's read by FD source and Displayed by G streamer pretty much as I just showed you on the command line. This is all it does When you take a picture so when you start the countdown That's a little more complicated because first off you have to close and re-init the camera. Otherwise You don't get get to take a picture It's a little tricky and yeah, then the the countdown will start after After a moment or a moment later The let's will start flashing or will start counting a count on a colorful one and then It will take the actual photo it will read the photo into G streamer and then it'll start a processing pipeline where it I've let's actually The in detail if you're interested so it goes through a couple of times the first time it Does a color correction so that the skin tones look correctly and it'll capture that again and It'll print it and first it'll display it and then it'll print it or it'll capture it so that it can be printed and so on So these things are in our git or online if you want to take a look at it So earlier I mentioned that G streamer is Pipeline-based that means that you can you have a data flow from the source to a sink and With processing elements in between and you can plug and play those together as you please I go into the Video preview pipeline again. So this is that fd source that reads from the camera The the video stream it'll filter it and the filter tells it which Format it has then this is a jpeg decoder element which will turn the separate jpeg images from the camera into a decoded video stream that you can work with like you you can't scale a jpeg video with G streamer or a jpeg image you can only scale raw Stream or raw video with it. So first you have to decode it and then you can scale it So so that it fits The screen size and the printer size because the preview video has pretty low resolution. That's one of the disadvantages of the G photo like I said it it's a Really high abstraction works generally every camera, but it doesn't work very well with every camera So you have a low resolution a high latency a low frame rate Okay, so you have to blow it up to fit the screen and then you have to maybe convert the Color space and then you can do an overlay of the Mask like of that Easter egg or gpn whatever you want That can have alpha transparency as well. So you would need format that supports that and Then at the end you can display that in the GTK sync is what the what I chose This is the video pipeline and The photo pipeline is a little different Then what I showed you earlier so it doesn't actually save it as a file Instead it'll save it into memory directly and then read that and Then do the JPEG decoding It'll have to turn it. It'll have to freeze it that image freeze turns that single JPEG frame into a video stream and Then the video stream can be processed as before With the overlay conversion a gamma is like makes it darker or brighter Can correct that and that T element splits it up into three different paths And the first path is a LCMS that's a little color management system like I said before that Corrects the skin tones because the type of printer that we use need a color correction a color profile. Otherwise, it looks really funny Then the second route goes into a JPEG encoder and that turns that raw video back into a JPEG image and saves it on a hard disk and the third third one just goes to the screen and displays it and You may wonder where is the social media upload the social media upload uploads the JPEG that's safe to the disk Well, that's not an own path there Okay, so I talked a long time about the Software now, let's go into the hardware real quick We'll open up that box and there is pretty much a general purpose PC main board in it it's a regular PC that runs Linux and we work with a digital with a good digital camera Like I said, it's supported by LibG photo. It has to be supported But if it's a modern one then there's a good chance like if you go with a Nikon or a Canon or It's pretty much guaranteed that it'll work Why are we using that and not just a webcam it's because of course, you get a lot better picture quality if you want to give the The JPEGs that you you save to a client then They have to be like decent quality. You could make prints from a webcam That'll be enough that's how the Actual photo booth that you may find at a lot of places work Because it's a lot easier grabbing the video from webcam and then just turning that into a photo Then it is the other way around but we do it anyway What also helps is it has a flash Output of course on the top the hot shoe from the camera that you can plug that in and We are working with a cheap wireless transmitter So the flash is not controlled by the software or anything or LibG photo. It's controlled by the camera itself Yeah, and the camera of course already existed We had one and we have another one that we want to test it with Yeah so Generally you will find a digital camera in any hacker space maker play space I guess so you don't have to buy that Specifically for it and you can just put it in in the booth if you want to use it And then take it back out really easily. It just mounts on the on the tripod mount Good the next component is the touchscreen of course I just bought something of eBay and it was advertised as an open frame TFT touch display and turned out to just be a really cheesy regular display and a resistive glass with a sensor and A USB controller and apparently somebody hadn't gotten it to work and sold it again But it worked quite well in Linux There's an X input calibrator and it works like a like a mouse pretty much just have to set the coordinates and then it works I Use VGA because the HDMI had some flickering issues. I don't know if it's a graphic card or the the controller of the Display probably more like that Well, that's okay printer, I think yeah, it's Over there. It's a really big box Why did we go with one of those? It's because we needed something that was really quick and had decent quality and there's the little portable Photo printers, but they are super slow they take over a minute for For a little photo and they are super expensive like the media is Cost like one or two euro for a single print So we decided we needed something that will be able to handle the case where there's six people Sending in front and they want two copies for each one We can't just make the people wait for half an hour and then come back later. They want it instantly so we needed a Thermo sublimation printer This is like the type that you will find at the drugstore where you can go with your USB stick and print out your camera pictures I got one a used one from a photographer for a good price Yeah, it has a big roll of paper Like endless paper in it and it'll actually cut With a knife cut off the the separate Pictures when they're done printing and that makes it really cheap so it's less than sense 15 cents per copy and of course the thermal sublimation Means it's a dry right away So you don't have to wait until some ink is dry or anything you can touch it as fine But those things are expensive. So this one would cost over 1,800 euro when it's new It's an older model But once I come out still are in that price range because they're not consumer products They are that professional equipment A problem of course is the availability of drivers The manufacturers never make them so I I don't know of any thermal sublimation printer that has native linux support but there is that good print project and that has drivers for a lot of Color laser printers or laser printers in general and also those dye sublimation printers so thermo sublimation Um, yeah, they have have another problem They're really big and really noisy and really heavy When you can actually really hear them work through the box Very loud. That's okay So you need to carry the carry that thing separately. It's 18 kilos roughly and of course you need to take care of the Image color match matching yourself because otherwise it'll come out looking funnily. It's like I mentioned before Good, yeah, the PC is a standard main board Something that I had in the cellar just laying around nothing special nothing fancy It would work with an embedded PC that would be nicer We wouldn't have to worry about like open parts and coolers that you could touch or But just didn't have one laying around Yeah, and there's an Arduino Uno Which controls some RGB leds that we have to catch attention around the camera lens and a stripe on the printer tray on the output tray I'll just show you real quick Okay, I can just open the terminal emulation here and then Probably makes us a little larger and then just It will read Chars through the serial port and then turn that into commands. So if I write a Little see then the countdown will start six seconds countdown and This is supposed to focus the attention of the person that's being Photographed into the lens. It doesn't always work. Usually they look at themselves in the screen down below Usually we have to tell them. Please look in that lens and then a little f will make it flash and P and a number will make the the bottom one glow and shine in the processing colors of the Dye sublimation printer. So, you know, now it's doing the blue now. It's doing the magenta now It's doing the yellow and then this is the real time And then the print is done Just so that, you know, it's working. Of course, you can hear it unless it's really noisy Okay, so let me exit that Yeah, I do, you know, good. Okay, this is about the the woodwork We wanted like a natural friendly environmentally friendly Thing we built it out of all used parts So we didn't want a like an aluminum or a really shiny high glossy box for it instead we used wood of course and it's It's 10 millimeter plywood covers and on the inside. There's a framework from Yeah, with like Leisten, that's the German word. I don't know what the English word is Frames probably Yeah, I drew that in Sketchup. That's the only software used in the whole project. That's not open source It's free, but it's not open Just because I knew how to use it We could probably use free cat or something. It's just to draw to draw that thing this these these images also come out of Sketchup and And Yeah, I did it in the workshop of my dad and he is pretty well equipped with the saws and different stuff So this is where we could do to do all of that One interesting detail is probably that I had to use glazing tape for fitting that Screen into the into the Cabinet because it wasn't a an OEM open frame Screen after all it was just a regular one that is meant to be in a plastic case like the regular Consumer one so I used a tape that is flexible that's usually meant for building windows on glazing tape and That is used in different parts too just for Like underneath the camera on the camera mount the camera is held on on the bottom with the tripod mount and I made a custom screw for that because it is a Quarter inch you and see mount as something that's not really used anywhere else in Germany Yeah, so I used a regular screw and cut that Mount into it Yeah, the printer and the camera are transported separately and all of the other components are fixed inside the box there's also speakers speakers that will play a countdown beep and Can play some music and we usually just put them on top but They're supposed to go somewhere in the box link on the side or something Once I figured out how to do that nicely and there's a butterfly locks They allowed Transporting it easily. It's like from stage equipment like in a flight case. You can find those things It's really sturdy and carry handles Yeah, and the bottom is a Tripod and that is supposed to be a Reminiscence of like actual photo tripods or optical devices Like they still have the camera ones and Of course, they can't they can't wobble if it's three instead instead of four. That's another good thing Yeah, of course, we also have some some 3d printed parts that is mainly the little tray that the photos fall into and we've printed that on our makerspace rep rep and There's another part which is That will protect the 3d leds. That's a little diffuser thing and When the printer is not in the box, then you can also Doesn't break off as easily okay issues Well, so once we use that thing on a on a intercultural Fair in our shopping book and it was a really hot July day glaring sun and The display isn't really fit for that. So there's not enough contrast to really be able to see yourself So you have to turn it into the shade Then then it's possible, but it's not optimal That Fairground wasn't paved. So there was a lot of dust and the dust went everywhere So we were really having a hard time getting it cleaned afterwards Especially since we had to open the back. There is a cover for the back, but we couldn't close that because it was getting too hot We are missing a few Fans in there. So the heat builds up especially from the printer It's a thermal Sublimation process which pretty much means it it'll Thermically it'll heat Ribbon with color swatches and turn that into Into a gas phase and then bring it onto the paper that way So it gets really hot. It has over 400 watts during the printing process and the camera gets really hot during the preview Considerably actually and of course the display and the PC don't help either so we we need If we really want to use this during the summer outside then we need some ventilation concept and It would be best to use like filters in front of the Fans so that we don't suck all of the dust into it Yeah, it usually takes a while or we're getting better at it We're learning but it takes a while to set it up properly just the photo set up the exposure time the What's it called the aperture all of those things? Auto focus is horrible that went really wrong So the autofocus will you can only trigger a photo and then it'll start Focusing and the photo the focusing may take from like point one of a second up to two or three seconds because when there's people moving in the background or when it doesn't know how What to focus on properly then it may zoom in and out all the way until it finds the the sweet spot and That wasn't really working well because we are doing a countdown and people expect the picture to be taken at zero and not some time so we had to turn off the autofocus and Just we're usually just moving people into the into the focus spot with a manual focus There's a lot of room for improvements. Am I over the time? Okay, so I Already mentioned some of these things Cool gimmick would be for example a coin validator people Throw in a coin and then it takes a picture Something is like that and just make it more robust or print QR codes on the copies so that people can download it things like that so the cost is was Roughly about thousand euro and that has already paid itself off by donations that people give us for the prints So this is now a money-making machine for our Hacker space so consider building one if you want to have some public relations and Publicity you can give out your flyers together with the prints and print your logo on the copies and Make some donations with it. Yeah, that's the intention Okay, any questions if we're yeah, yeah, oh, okay You got a microphone How much time did take making everything including what everyone else did? Yeah, it took Only about eight weeks and that was because we had a strict deadline of that one event the Christopher Street Day 2016 in our Schaffenburg that it had to be done for and We added a few things afterwards like the social media upload Twitter. We actually implemented during last Easter hack So it still worked on and improved But the the whole thing like writing the first line of code and building the whole box only took eight weeks I don't know Was like a part-time project and mainly me There were a few people helping with the Arduino on things, but wasn't that many man hours? Code is on git if you want to look at it If you have any more questions, we're in the lounge and you can come take a picture of yourself would be nice