Focus Stacking Macro Photographs with a Hacked Flatbed Scanner

focusstacking-2

Focus stacking is when you combine multiple photographs of different focus distances in order to obtain a single photo with a much greater depth of field than any of the individual shots. This can be done by turning the zoom ring on your lens, but this can be difficult to control (especially for highly magnified photos). It can also be done using special rigs designed for the purpose, but those are generally quite pricey.

Photographer and software engineer David Hunt recently came up with the brilliant idea of turning an old flatbed scanner into a macro rail for shooting focus-stacking photos.

Hunt writes that the main question was whether the scan element could support a hefty DSLR and lens:

I came up with the idea of re-purposing an old flat-bed scanner that I had in the attic gathering dust. It’s so old, that the most recent drivers available for it are for Windows XP. So it hasn’t been used in a couple of years. Being a scanner capable of 2400 dpi, it was definitely accurate enough, but would it be able to move a 3KG camera and lens? If I could get at the stepper motor to drive the scan element, maybe I could attach a camera to it and move it in very fine increments, ideal for macro photography.

After opening up the scanner, Hunt found that it didn’t require too many additional modifications. There was already a nice flat platform for the camera to rest on, and the movements were small and smooth enough to not jar the camera between shots.

In addition to the scanner, Hunt uses a Raspberry Pi to serve as the brains of the rig. The single board computer connects directly to the stepper motor interface of the scanner, and can move it at various speeds. Hunt uses it to move his camera towards his subject in increments as small as 0.02mm, with an exposure snapped at each stop.

Here’s a video showing the rig in action:

Here’s a before-and-after comparison showing what a single exposure looks like and the increased depth of field that is achieved by stacking a large number of them:

focusstacking-1

Head on over to Hunt’s blog if you’d like to examine some of the more technical details of the project, including the Python code he wrote to move the scanner mechanism at tiny increments and to trigger his camera’s shutter.

Macro Pi – Focus Stacking using Raspberry Pi [David Hunt via Imaging Resource]


P.S. Hunt is the same photographer who turned his broken battery grip into a tiny computer for controlling his DSLR.


Image credits: Photographs by David Hunt

Discussion