Focus Stacking with the Phase One

Written by Paul Bourke
April 2016


Focus stacking is the process by which multiple photographs, each with a different focal plane, are combined into a single image with an overall deeper depth of focus. The most common application is in macro photography where the object is close to the lens and the depth of focus does not extend across the depth of the object. While using limited depth of focus is often an artistic/composition choice, there are other applications such as digital recording for archive purposes where having all depths in focus is desirable.

There are a number of ways the multiple focal levels can be arranged. They may be set manually, simply focusing on a different part of the object for each photograph. Or one can use a mechanical slider, focus on the camera set and the camera is moved closer or further from the object. This later approach has the benefit of not introducing focus breathing, the process by which the zoom changes slightly with focus. However current focus stacking algorithms are able to correct for slight zoom changes. There are also motorised and various levels of automation that can be applied to each of the above two techniques. It goes without saying that this process is only suited to tripod mounted camera and stationary subject matter.

This document presents focus stacking in the context of the Sony Phase One camera, one of a number of tests conducted with the camera. The Phase One is the most recent medium format camera from Sony with a 100MPixel back. The latest revision (at the time of writing) of the Capture One Pro software includes an automated focus scan controller. These focus stacking controls consist of setting the near and far focus points and the number of focus points within that range. For optimal results for accurate focus on the Phase One the computer controlled focus controls through Live View on the Capture One Pro software is a necessity.


Automatic focus stacking controls

Example 1

Two examples are presented here, fairly traditional applications of focus stacking. The lens used on the Phase One is their 120mm macro lens. In this first example only 12 photographs were taken, as it happens this was insufficient (see zones of slight lack of focus in the final stacked image). The number of photographs to take is not always a simple matter to determine, it depends on the aperture and the range of depth one is trying to capture. The algorithms require an overlap in the focused zones in order to align and deal with scaling from focus breathing. Typically a 30% overlap of the in-focus layer is the rule of thumb, if you have a camera that shows in-focus regions then that can be used to check suitable overlap.


Closest part of object

Note that one does not necessarily choose ever smaller apertures (higher f-numbers). At some point blurring will start to occur due to diffraction effects. While the lens employed was determined to be safe up to f16, for the image here f7 was chosen.


Furthest part of object

The following is the final focus stacked image.


Download or click to explore full resolution

Fundamental to the algorithm is determining the various in-focus zones. These are shown below shaded by depth (white most distant, black closest to the lens), the black surround arises from lack of any focus on the grey background.


Greyscale depth map

One could then also interpret these layers as depths of a 3D surface, this is shown below. In this case it is a rather poor 3D model with clear discrete steps in depth, not unexpected from only 12 photographs. While one may consider this an alternative approach to 3D reconstruction, it performs much poorer for a number of reasons. Mainly, it is just a height field perpendicular to the camera position so obviously cannot resolve concave features. Also the focus zones are generally quite coarse compared to the structures once could readily derive from a 3D reconstruction approach.


3D model


Example 2

In this example 30 photographs were taken across the chosen depth range. One can imagine that now that the process is automated then one might choose to err on the side of too many photographs knowing that only every 2nd or 3rd might be used for the focus stacking process.


Closest part of object


Furthest part of object

Focus stacked image.


Download or click to explore full resolution

Software

  • Capture One Pro 9 from Sony was used to control, capture and export photographs. No processing was performed on the photographs. Care should be taken to disable the export filters, in particular the sharpen filter on export is enabled by default.

  • HeliconFocus 6.6.1 from Helicon Software Ltd was used to perform the focus stacking. Strangely it doesn't support PNG files, TIFF should be used in the export from Capture One Pro rather than lossy JPG.


Greyscale depth map

While the increased number of layers has improved from the first example, they are still discrete layers capturing global curvature but not surface structure. Quality of reconstructed surface is clearly inferior to other techniques, such as 3D reconstruction. Additionally it is only from one view position. However it may provide better results for surfaces not suited to 3D reconstruction such as highly reflective/specular surfaces.

One might ask if focus stacking can be used to create photographs that are then used for 3D reconstruction. The answer is definitely yes but the automated approach used here would not be suitable due the focus breathing and the resulting variation in the focus stacked images.


3D model