Sunday 24 May 2020

Experimenting with Focus Stacking

Focus Stacking is supposed to be a good way to increase the depth of field, especially for macro photography.

In an idle moment I noticed that my camera had a built in mode to help with this.

So here are my notes on focus bracketing and stacking.

Most of the time I use my Olympus OM-D E-M10 Mk3 in basic manual mode. However, this u4/3rds camera can also do a few other tricks. In the AP mode (advanced photography  ...wooow!) it can take 8 photos at different focus settings.

This is a dumbed-down implementation of Focus Bracketing which you will find on the Mk2 and several other Olympus models. This simplified version only takes a fixed number of exposures (8) and can be set for either wide or close spacing.

The Mk3 cannot do Focus Stacking, which combines each exposure into a single final image. You have to do that yourself on a computer, which on Linux probably means either The GIMP or Hugin/Enfuse.

There are a couple of points to consider when taking shots for focus stacking on the Mk3. The first is that each image must have a depth of focus which over-laps with the next image. If this is not the case, your subject in the final stacked image will go in and out of focus between each exposure.

The second issue that I had was that the individual exposures seemed to be recorded out of sequence;

image number > front to back order
  • 1 > 3
  • 2 > 1
  • 3 > 2
  • 4 > 4
  • 5 > 5
  • 6 > 6
  • 7 > 7
  • 8 > 8

I assume this is a camera firmware problem (my Olympus Body firmware is 1.1). Whatever the reason, I decided to rename each file to put them in the correct order before importing into the editor.

I chose to photograph a small engineers steel rule, which highlights some of the difficulties that may not be so apparent if I'd selected an insect to photograph.

single photo taken on Olympus OM-D E-M10 Mk3 + Lumix 45mm macro lens

On a 45mm Lumix macro lens, I started at f2.8 but had to shut it down to f8 to get acceptable (over-lapping) results with my chosen subject.

I opened the 8 images taken in Focus Bracketing mode in Gimp as layers. The top layer in the Gimp stack is the last image taken and the one focused furthest away from the camera. The editing method that I used is similar to the one described by Tom Bland in his video: except I...

  1. Re-order images to allow for Olympus problem
  2. Open as layers in Gimp (so furthest away is at top)
  3. Toggle eyeball for top layer to find focus transfer point (i.e. best compromise where both images are equally in focus)
  4. Pull down guide to mark the point
  5. Re-assess (toggle eyeball)
  6. Draw rectangular selection box from top down to marker
  7. Add Layer Mask - White (Full Opacity) - Invert Mask
  8. Fill selection with white using Bucket Fill
  9. Merge Down (i.e. from layers right-click menu)
  10. Clear Guide & selection box (select All)
  11. Repeat process for each layers (except last, which will be your final image)

Although most of the steel rule is now in focus, I have another couple of problems. Have you ever noticed how the size of the viewed image changes slightly as you focus a camera? This seems to result in slight changes of scale between each of the individually focused images.

In my image you can clearly see variations in rule width. It would be another operation to re-scale each image to blend it with the previous or neighbouring image.

You will also notice horizontal banding, which would need further processing (I'm not sure what has caused this).

We also have a Panasonic DC-G9 which does the whole focus stacking business inside the camera. This is what a single image looks like;

...and the stacked image:

The Panasonic has done a good job, but look how much the image has been cropped!


Working with a more complex object is both more demanding, while at the same time probably more forgiving. I took 8 shots using focus bracketing of this rose, but eventually only used 3 layers to produce the final shot;

Olympus OM-D E-M10 + 45mm macro lens, single shot: 1/200s, f4, ISO200

Same setup: Focus stacked from 3 focus bracketed shots

At the moment I find the whole process frustrating and so far have clearly not mastered it. I dare say that a bigger, better monitor would help.

If you are looking for a camera to do lots of focus stacking, the Olympus OM-D E-M10 Mk3 may not be the best choice. Other Olympus cameras like the M10 Mk2 or M1, M5 or the Panasonic DC-G9 mentioned above have more options for control and adjustment, so may be a better choice ...or may turn out to be even more frustrating.

No comments:

Post a Comment