Focus-stacking with Raspberry Pi for macro photography

Dave Hunt is on a bit of a roll at the moment. Not content with having engineered the water droplet photography setup behind the prettiest post we’ve featured here, he’s also been working with the Pi and an home-made macro rail for sharper macro photographs without all that woolly depth of field. Bokeh – the fuzzy blur from the out-of-focus parts of a picture – is an effect that can be really beautiful, but sometimes you want a sharper picture, which can be nigh-on impossible in macro photography without special equipment.

Dougal, this cow is small. Those ones are far away.

There’s a way professional photographers deal with this, but, of course, it’s expensive. You can buy a rig which allows you to take many images, each taken a little closer to the object, so different parts of it are in focus with each picture. You can then combine or stack all those images in software, as in the cow picture on the right. There’s an open software solution to the matching and stacking problem called¬†CombineZ¬†(somebody port this thing to the Pi; that GPU is built for just this sort of application), but if you want to buy a rail that automates the moving of your camera, things suddenly start to look expensive. Dave says commercial solutions come in at around $600.

Enter the $35 Raspberry Pi and an old flat-bed scanner from the loft.

If you want to build your own focus-stacking rail, Dave has full build instructions, including circuit diagrams, code and tips on where to get parts at his website; even if you’re not a seasoned electronics hacker, you should be able to follow his very clear instructions if you want to make your own. Thank you Dave, for another great money-saving photography project and a fantastic writeup. We like your cow.