Focus stacking

[2][3] Focus stacking can be used in any situation where individual images have a very shallow depth of field; macro photography and optical microscopy are two typical examples.

Focus stacking offers flexibility: since it is a computational technique, images with several different depths of field can be generated in post-processing and compared for best artistic merit or scientific clarity.

Alternative techniques for generating images with increased or flexible depth of field include wavefront coding, light-field cameras and tilt.

A high numerical aperture (equivalent to a low f-number) gives a very shallow depth of field.

Atomic resolution scanning transmission electron microscopy encounters similar difficulties, where specimen features are much larger than the depth of field.

Series of images demonstrating a six-image focus bracket of a Tachinid fly . First two images illustrate typical DOF of a single image at f/10 while the third image is the composite of six images.
Focus stacking (for extended depth of field) in bright field light microscopy . This example is of a diatom microfossil in diatomaceous earth . Three source images at different focus distances (top left) are combined with masks (top right) to obtain the contributions of their respective images to the final focus stacked image (bottom). Black is no contribution; white is full.
Stacked image of the Curiosity Rover 's first sampling hole in Mount Sharp . The hole is 1.6 cm (0.63 in) wide and 6.7 cm (2.6 in) deep.