Begin by mounting the Canon SX230HS on the macro lens adapter, zooming to about the maximum, fiddling with a ruler to put the end at the closest focus point, and eventually get an overall view like this:

The images below were batch cropped from similar views with ImageMagick:
for f in $(seq 17 22) ; do convert -crop '1500x1126+1900+1800' \ img_18${f}.jpg img_18${f}-crop.jpg ; done
Yes, I’ve taken a bit over 1800 images since getting that camera… the old DSC-F505V recently rolled over at 10K images.
Take a set of six identically exposed pictures starting with the focus at infinity (about 95 mm in real life):

And ending with the closest focus at about 1 meter for this zoom setting (and 80 mm in real life):

Then apply enfuse (from the Ubuntu repositories) with a handful of parameters suggested there that combine the sharpest parts of each image into a single image:
enfuse --verbose --exposure-weight=0 --saturation-weight=0 \ --contrast-weight=1 --hard-mask --output=stacked.jpg \ img_18??-crop.jpg
Which produces this nice result:

It’s not perfect, it needs a few more intermediate images, there’s fringing around high-contrast edges, and so forth and so on, but for a first pass it ain’t bad at all.
I bar-clamped the camera & macro adapter to the desk in order to eliminate all motion. My usual tripod mount for the macro setup isn’t all that stable and the microscope stand isn’t particularly rigid, either, so I must improve a bunch of mechanical structures. In principle, you can post-process the pictures to realign them, although the tolerances seem daunting enough to make mechanical fixturing look downright attractive by comparison.
Now, if it should turn out that the SX230HS supports the CHDK USB remote trigger, that’d be nice. Or maybe the right way to proceed involves converting the problem to A Simple Matter of Software by writing a CHDK script that tweaks the focus by multiples rather than increments.
2 thoughts on “Macro Lens Focus Stacking”
Comments are closed.