27 December 2015

Project: Photo Booth

Not too long ago, I was at a celebration where there was a photo booth. A camera on a tripod was pointed towards a backdrop. People could grab some props, stand in front of the backdrop, and the attendant would start the program, which would take a picture every 5 seconds or so. In between shots, you could race over to the props table, grab something new, race back, and pose with it, all before the timer expired.

The pictures would be composed onto a 4x6 photograph, complete with a logo of the event electronically slapped onto the corner, and printed out for you.

It was a lot of fun. Every party should have a photo booth.

For small, friends-and-family gatherings, though, the manned photo booth is unreasonable (and probably cost prohibitive). Fortunately, we live in a Maker era, and computing parts are affordable and abundant, so like many, many others (as is well documented on the Internet -- just like this post!), I decided to make my own photo booth.

TL; DR;

Fear my mad woodworking skillz!
The photobooth is a Raspberry Pi with an attached 7-inch touch screen for user interface and input. The Pi controls a Canon 300D / Digital Rebel DSLR over USB using gphoto2. Photos are downloaded to the Pi, re-sized, and composited together with a logo using ImageMagick. The composites are manually scp'd off the Pi occasionally, put on an SD card, and printed on a Canon Selphy CP910.

The whole application is written in Python 2.7 with a Kivy front end.

Unlike other photo booths which wrap everything up in a box or some such, I opted for a minimalist approach. Since I was using a DSLR on a tripod, I decided to mount the display, which holds the Raspberry Pi behind it, to the tripod neck, just below the camera (which is where the subjects should be looking, anyway). I had some scrap pieces of wood to make a frame. Wood glue and nails hold the frame together, and I chiseled out a ledge for the Raspberry Pi display to rest on. Some plumbers straps hold the screen in place via the mounting holes on the back, and some wood screws into the frame. Finally, a couple of U-bolts and foam hold the frame to the neck of the tripod.

Et voila!

Camera

Initially, I was going to use a Raspberry Pi camera, but I was worried about light. The Raspberry Pi camera is tiny, so needs a lot of light to take good pictures. A DSLR would be better, since it's a huge light bucket in comparison, and I happened to have an old Canon 300D / Digital Rebel sitting idle. Once I discovered gphoto2, there was no going back.

The down side to using a circa 2003 camera is it communicates over USB 1.1. Which...

...is...

...really...

...slow.

Downloading an image off the camera takes 30 seconds at highest resolution (a whopping 6.3 megapixels). Dropping the camera to lowest resolution reduces the time to around 15 seconds, but it's still painful. I ended up adding messages to the display while gphoto2 was churning in the background so the users don't think the application broke.

All this could be mitigated by using a more modern camera with a fast memory card and USB 2 (A faster microSD card in the Pi wouldn't hurt, either). But my budget for this project did not allow for the purchase of a newer camera. So interesting messages it was.

Printer

Based on this instructables, I opted for the Canon Selphy photo printer. It was around $80 on Amazon, and I could use it to print personal photos from home when not being used by the photo booth.

When I went to purchase a Canon Selphy, the CP900 had been replaced by the CP910. I figured it was still a pretty safe bet, since there weren't many differences between the two -- just the WiFi access point, as far as I could tell. And if I could incorporate the access point in the photo booth, bonus!

Unfortunately, things did not work out as I had hoped. The Gutenprint drivers available for the Selphy printers did not include the CP910 because it was too new. And unlike others' experiences with the CP900, the older drivers did not work well for me, even when talking tot he printer over USB. I was only able to print one picture. The next time I tried to print, the printer would load the photo paper, then hang. I had to disconnect the USB cable to get out of that mode, and then upon page ejection, the ink cartridge would be aligned to the wrong color (ah, dye sublimation printers).

The image was getting out of the cups queue, so I surmised something was wonky on the printer end.

The Selphy did, however, print just fine in batch mode from an SD card, so I opted for a manual, sneakernet solution. Every once in a while, I would collect the accumulated photo booth photos via scp, copy them to an SD card, and batch print them. The printer only holds 18 pages in the tray, so there would have been a lot of interruptions to service the printer anyway.

Conclusion

This was a fun project. I learned a bit about new libraries, and introduced myself to a new user interface option. I wrote some really ugly code while trying to wrap my head around all the new stuff. Now that I have a better idea of how things are supposed to interact in Kivy, I should go back and write things better. Make some unit tests to verify my code. Comment my code better. Make it ready for prime time. But I probably won't. 

This was, first and foremost, a research project to explore new ground. And when venturing into the unknown, it's hard to do test-driven development because you're unsure how things are meant to work. There was a lot of iterations on design on this project as I slowly figured out how Kivy wanted to be used. Once you've got an understanding of how things are supposed to work, then test-driven development can come into play. We'll use it on the next project.

Want to see what my ugly code looks like? This project is available on GitHub. Please check out my other projects to see how I normally write code.

06 December 2015

Poecile atricapillus

Black-capped Chickadee
Meet Poecile atricapillus, the black-capped chickadee. The bird that Cornell Lab of Ornithology's All About Birds website calls "one of the first birds most people learn." Just not in my neck of the woods.

I had to travel North to observe this bird. Based on what I saw at the feeder, I though getting a shot might prove difficult, given that the chickadees were prone to darting in, grabbing a seed, and departing just as quickly (I also marveled at how clean things were around the bird feeder. The finches and sparrows in my neck of the woods tend to hang out and make a mess. Chickadees eat elsewhere.). Happily, I was proven wrong. The chickadees seemed to feel much safer in the trees, and would pause long enough for me to frame, focus, and capture a few images.

With an acceptable image in camera, it was time to learn about this avian fluff ball. When it comes to birds, my first stop is usually All About Birds.

Here, I learned the chickadee's diet is a mix of insects and seeds. Looking at the beak, that makes sense. It is not as thick as a seed eater like a sparrow or finch, but it is not as thin as an insectivore like a wren.

WTF?
Under the "Cool Facts" heading, I found out why the chickadee doesn't feast at the feeder (it hides seeds to eat later). But it was the second bullet point that made me pause and wonder if the site got hacked by a prankster:
Every autumn Black-capped Chickadees allow brain neurons containing old information to die, replacing them with new neurons so they can adapt to changes in their social flocks and environment even with their tiny brains.
 Um... And you know this how?

The answer, it turns out, is SCIENCE!

Back in 1994, black-capped chickadees were determined to have newly formed neurons in the hippocampal complex "with a marked peak in the fall." [1]

This was backed up by a study of songbirds published in 2003 which determined that in the fall, the chickadee's hippocampus expands in volume by "approximately 30 percent by adding new nerve cells." [2]

Thirty percent!

The first study was remarkable enough when it was published to have been written about in the New York Times, which may be more easily digestible than the actual paper. The Times article speculated on how this study may impact how we think long-term memories are formed as well as discussed the actual study. Not having followed neuroscience for the last 21 years, I can't comment on the impact the study actually had, but it sounds like a fun, educational, and huge time suck. I will have to add it to the list of fun, educational, huge time sucks to tackle when I have the time.

Disclaimer

I am not an ornithologist. My identification of the bird in the photo may be wrong.

References

[1]: Barnea, A, and F Nottebohm. “Seasonal Recruitment of Hippocampal Neurons in Adult Free-Ranging Black-Capped Chickadees.” Proceedings of the National Academy of Sciences of the United States of America 91.23 (1994): 11217–11221. Print. <http://www.ncbi.nlm.nih.gov/pmc/articles/PMC45198/>

[2]: Lehigh University. "As Autumn Approaches, This Chickadee's Brain Begins To Expand; New Nerve Cells Put Fall Foraging On Fast Track." ScienceDaily. ScienceDaily, 12 September 2003. <http://www.sciencedaily.com/releases/2003/09/030912072156.htm>.

14 November 2015

This Blog is Useless Without Pics!

I am five posts into this blog now, and I've come to the realization that the web is such a visual experience, even a blog purported to be about improving one's writing suffers from a lack of pictures. So here you go:
eggs in a water bath
Everything is awesome!
I was at Legoland California recently, and noticed this while getting lunch. It's an immersion circulator keeping their hard boiled eggs at serving temperature (and just out of the "danger zone") in a water bath. Presumably, they cooked the eggs with a circulator as well, based on their appearance in my bowl of "ramen" that I had for lunch.

This is exciting to me, since it indicates the acceptance of Modernist techniques at what might be the lowest level of culinaria -- the theme park food vendor. That is to say, Modernist tools are inexpensive enough that they can be introduced in areas where margins are everything. Though looking at the picture, Anova might want to beef up their clamp some (or sell a replacement) so the cooks don't have to resort to zip ties to hold the circulator in place due to a part failure.

Now if they could somehow make the food delicious...

08 November 2015

Living the Open Source Lifestyle

I've often wondered if I could break away from commercial operating systems (Microsoft and Apple), and successfully operate with only open source and freely available software. Recently, I came upon a second-hand computer, which afforded the opportunity to try it out without sacrificing my not-so-old Windows laptop to the effort.

The machine is a well-used laptop sporting a dual core Intel CORE i5 and 8 GB RAM. I purchased a 250 GB SSD for it and installed Ubuntu 15.10. I will disclose up front that I am very comfortable in the Linux environment, so there was no learning curve associated with the operating system. The question was whether or not the application coverage was sufficient. Let's tackle them in alphabetical order.


Browser

I use Chrome. `Nuff said.

Well, no, actually. Casting to a Chromecast doesn't work the same in Linux as it does in Windows. I can't queue YouTube videos in Linux like I can in Windows (or on Android, for that matter). Fortunately, I don't really do this much. In fact, I only started casting YouTube videos because Windows was producing audio artifacts during video playback. Casting got rid of them. So did Linux.


Documents and Presentations

Microsoft Word (and Excel, and PowerPoint) beats the pants off of LibreOffice. But then, so does Google Docs (and Sheets, and Slides). And for the stuff I'm creating, Google Docs is good enough.


Photo Editing

I put in a lot of time, sweat, and tears learning how to do things in Photoshop. I dreaded having to do the same for Gimp. It turns out, I may not have to.

LightZone seems to fill the gap nicely. And it feels pretty intuitive right off the bat. If I need layers, I can muddle my way around Gimp. Besides, with Adobe heading towards the annual subscription-based model for their products, having to learn Gimp feels like less of a deterrent. Wonder if my Wacom tablet works?

For photo organizing, I used Picasa. Picasa made organizing photos and sharing them on the Internet straightforward. It's too bad Google seems to have stopped supporting it. Fortunately, LightZone seems to reproduce much of what I used Picasa for, and Google Photo allows drag-and-drop onto the web page to create albums to share with friends (and large corporations), so Picasa's album sync isn't really necessary.


Programming

I've been programming in a Linux environment for a while now. In fact, I don't know how to do anything in Windows any more (unless it's in the Git bash shell), so this was a non-issue.


Tax Software

Um... Yeah. Hmm...


Video Editing

Making home movies is fun. In my household, they are usually some kind of stop motion creation. For really long movies, Movie Maker in Windows was found to be lacking, unable to render really long stop motion films from a myriad of stills. On my old Mac Mini, iMovie could do the job, but the newer OS X releases have effectively hobbled that machine.

A quick Internet search returned many possibilities. I'm going to try Pitivi. If that doesn't float my boat, there are myriad others out there.


Conclusion

The most telling observation is that in the week or so that I've been using this newly instantiated Linux box, I haven't turned on the Windows machine except to grab a bookmark in the browser (I don't sync them to the cloud) that I needed to transfer over, or a file that didn't make it onto the NAS.

The only thing I do miss from the Windows box is the built-in SD card reader for importing photos. But that's a hardware, not an OS feature. I miss it enough that I'm contemplating purchasing another SSD and doing a drive swap on that machine. Then I can have two Linux laptops in my possession. (You can't have too many computers in the house. Amiright?)

Come tax season, I can always pop the Windows drive back in the computer. Think of it as an incentive to get the taxes done quickly.

18 October 2015

On Career, Roller Coasters, and Surfing

When I was in university, I didn't give much thought to career. I knew what I wanted to do (write code), but beyond that, I was just riding the electrical engineering / computer science roller coaster wherever it took me. My idea of long term decision making was restricted to sending my resume to companies with cool sounding jobs, and eschewing the ones with terrible sounding ones. I gave no thought to improving myself for the next gig, or where my career would take me. I was very fatalistic about my career path -- what will happen will happen, so just go with it. Based on my interactions with the interns at work and talking to students at career fairs, I think a lot of college students are still this way. It is very easy because it takes little energy. But what if the track breaks?

When it comes to career, it's better to be a surfer and take control of your path as much is humanly possible when riding waves on the ocean of a career. Instead of just hanging on for dear life and seeing where the roller coaster track goes, you should direct your board across the wave. If the tide is out and the wave is going to crash on a reef, you should have the wherewithal to steer away from disaster, or end the ride on the current wave and paddle out for another. To do that, you need to keep your head up and see what's going on around you -- actually manage your own career.

Larry O'Brien has written many a column in Software Development Times on this very topic. This column made me stop what I was doing and read Peopleware, by Tom DeMarco and Timothy Lister. DeMarco and Lister discuss how a company, and its managers should treat its employees. I agree with pretty much everything they state in the book. The corollary is, what is prescribed in the book is what every engineer should be looking for, if not demanding.

O'Brien's discussion on professional networking and career maintenance (Part 1Part 2) was spot on as well. You're much more likely to find a gig through maintained professional connections than by submitting your resume to the human resources department of a corporation. Especially if that resume is filled with grammatical and spelling errors, or is just plain hard to read.

David Brady echoed O'Brien's opinions back in 2013, coming at it from a different angle in his posts on his blog, Heart, Mind and Code (Part 1Part 2Part 3). He went a bit farther than O'Brien did, going into where your professional loyalties should lie.

There's no point in me regurgitating what they wrote, since you can -- and should -- click on the links and read the writings for yourself. Both O'Brien and Brady are much better writers than I, and will get you thinking about managing your career.

03 October 2015

Picture This

Once upon a time, a man named David Brady published a blog called Insect Picture of the Day -- InsectPOD for short (I'd post a link, but the URL has long since expired. I'm two for two that way). On it, he would post a picture he took of an insect, would do some research, and write about it. It was fascinating stuff. When he requested user submissions, I was in, taking pictures of whatever insects I could find (a surprising variety), doing research of my own, and sending in the "good ones", hoping that he would publish them (which he did!). I learned a lot about phylum arthropoda in the process.

Thus was my introduction to macro photography.

As InsectPOD's update schedule waned due to life, so did my photo activity. It didn't help that in the meantime I had moved from a target-rich environment to one seemingly less so. Plus, you know, life. My trusty old first generation Canon Digital Rebel sat gathering dust. It's crappy old kit lens no longer actively frustrated me with its loose barrel fitment tolerances (I swear I can move it sideways enough at full extension for it to produce a noticeable tilt effect). Instead, it would mock me from the shelf.

Damned if you do. Damned if you don't.

Eventually the photography bug won. I switched teams and picked up a Nikon DSLR with its not-as-crappy-but-kinda-slow kit lenses and started shooting everything I could. Once I learned how best to shoot with the kit lenses, I even managed to take some decent photos. Armed with a 300 mm zoom (part of the kit), I learned to embrace telephoto photography. It wasn't all that different than macro! Your end goal is to fill most of the frame with your subject. Also, lenses are expensive and you always want more magnification. As an added bonus, there was less chance of getting stung or bit by your subject, or its compatriots.

But macro still called.

Macro with the kit portrait lens was less than fulfilling, and the zoom didn't focus on anything closer than nearly a meter away. Gear Acquisition Syndrome lost to economic reality, so that scrumptious looking 105 mm Nikkor glass was out of the question. The photography bug was on the verge of going back into hibernation when the Internet gave me the answer: extension tubes and lens reversal kits.

Extension tubes, unlike photo multipliers (doublers), pull the minimum focal distance in because the lens sits further from the sensor with no optical correction. In theory, I could put some tubes behind my 55 - 300 mm zoom and have a variable magnification macro lens (minus a stop or two in light gathering). And a very large on, at that.

What was more interesting, however, was the lens reversal kit. I had no idea that you could do such a thing with today's interconnected cameras and lenses. And I never thought about the consequence if you did so: really high magnification. All on the cheap. I was so in.

I've been playing with my tubes and reversal kit for a couple of days now. Early results are not share-worthy, but are good enough to feed the photography bug. One thing's for certain: with lens reversal, augmented lighting is a must. For now, I'm playing with the Pringle's can solution, but ring flashes aren't too expensive, so I will probably end up going that route. Also, the reversal ring is never coming off my 18 - 55 mm portrait lens. Not by choice. It's just really stuck. So maybe a replacement is in order? Damn you GAS! *shakes fist*

19 September 2015

Hello, World

Here I am. A little late to the game.

Not really. I've had blogs before. Out of some masochistic instinct (or, more likely, ignorance), I once rented some server space and maintained a WordPress instance myself. Bots put me off that pretty quickly, so here I am on Blogger, relying on Google to keep the spam to a minimum. But I digress (at the beginning of the post. Not a good sign).

Relaunching my self-publishing on the Interwebs, I've decided to concentrate on the content instead of the technology. If Blogger as a platform is passe, so be it. I choose to not be distracted by the newest and shiniest platform as long as the one I'm using gets the job done.

Must be getting old.

Just Keep Drawing Writing

A lifetime ago, I drew a webcomic (do they still call them that?). I would link to it, but I let the domain name expire. When I was actively drawing, the sage advice to those with small readerships was "just keep drawing!" It's the only way to improve.

Not too long ago, when a Google search returned yet another Jeff Atwood Coding Horror blog entry, I followed some link chain and ended up on his 26 October 2007 post, of which I will give the executive summary after this colon: "Just keep writing."

Recently, in my physical mail, I got a sample magazine that kind of reminded me of the old Dr. Dobbs Journal, but wasn't really grabbing my attention because its focus was more on the Microsoft stack, and I currently operate in the Linux world. But the last article (what's with this trend of columns starting on the last page continuing on the previous page?) really spoke to me. Its author is Ted Neward, and it was titled, "On Liberal Arts". The gist of Lesson #2 in the article? You guessed it. "Just keep writing."

So here I am.

What's It All About?

I'm not entirely sure what I'm going to write about. That's not really the point. The point is to write. To become a better communicator.

And, maybe, to republish my old webcomic. Seems all the rage, lately.

And, maybe, draw some new ones. If my Wacom tablet still has drivers available, that is.

Finally: It's Talk Like a Pirate Day

Shiver me timbers! We be publishin' again! Aaaar!