Focus stacking

Digital image processing technique


title: "Focus stacking" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["articles-containing-video-clips", "digital-photography", "image-processing", "photographic-techniques"] description: "Digital image processing technique" topic_path: "arts" source: "https://en.wikipedia.org/wiki/Focus_stacking" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Digital image processing technique ::

::figure[src="https://upload.wikimedia.org/wikipedia/commons/5/59/Focus_stacking_Tachinid_fly.jpg" caption="DOF]] of a single image at f/10 while the third image is the composite of six images."] ::

::figure[src="https://upload.wikimedia.org/wikipedia/commons/5/50/FocusStack_BrightFieldLightMicroscopy_DiatomaceousEarth.jpg" caption="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."] ::

Focus stackingalso called focal plane merging, z-stacking, focus bracketing or focus blendingis a digital image processing technique which combines multiple images taken at different focus distances to give a resulting image with a greater depth of field (DOF) than any of the individual source images. 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 can also be useful in landscape photography.

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. Focus stacking also allows generation of images physically impossible with normal imaging equipment; images with nonplanar focus regions can be generated. Alternative techniques for generating images with increased or flexible depth of field include wavefront coding, light-field cameras and tilt.

Technique

The starting point for focus stacking is a series of images captured at different focus distances; in each image different areas of the sample will be in focus. While none of these images has the sample entirely in focus they collectively contain all the data required to generate an image which has all parts of the sample in focus. In-focus regions of each image may be detected automatically, for example via edge detection or Fourier analysis, or selected manually. The in-focus patches are then blended together to generate the final image.

This processing is also called z-stacking, focal plane merging (or zedification in French).

In photography

Getting sufficient depth of field can be particularly challenging in macro photography, because depth of field is smaller (shallower) for objects nearer the camera, so if a small object fills the frame, it is often so close that its entire depth cannot be in focus at once. Depth of field is normally increased by stopping down aperture (using a larger f-number), but beyond a certain point, stopping down causes blurring due to diffraction, which counteracts the benefit of being in focus. It also reduces the luminosity of the image. Focus stacking allows the depth of field of images taken at the sharpest aperture to be effectively increased. The images at right illustrate the increase in DOF that can be achieved by combining multiple exposures.

::figure[src="https://upload.wikimedia.org/wikipedia/commons/f/fa/PIA18609_-First_Sampling_Hole_in_Mount_Sharp.jpg" caption="abbr=on}} deep."] ::

The Mars Science Laboratory mission has a device called Mars Hand Lens Imager (MAHLI), which can take photos that can later be focus stacked.

In microscopy

In microscopy, high numerical apertures are desirable to capture as much light as possible from a small sample. A high numerical aperture (equivalent to a low f-number) gives a very shallow depth of field. Higher magnification objective lenses generally have shallower depth of field; a 100× objective lens with a numerical aperture of around 1.4 has a depth of field of approximately 1 μm. When observing a sample directly, the limitations of the shallow depth of field are easy to circumvent by focusing up and down through the sample; to effectively present microscopy data of a complex 3D structure in 2D, focus stacking is a very useful technique.

Atomic resolution scanning transmission electron microscopy encounters similar difficulties, where specimen features are much larger than the depth of field. By taking a through-focal series, the depth of focus can be reconstructed to create a single image entirely in focus.

Software and applications

::data[format=table title="Focus stacking software"]

NamePrimary authorApplication typePlatformLicense
Adobe PhotoshopAdobeDesktopWindows, Mac OS XProprietary
Affinity Photo 'Focus Merge'SerifDesktopWindows, Mac OS XProprietary
Aphelion with Multifocus extensionADCISDesktopWindowsProprietary, 30-day trial
Amira / Avizo 'Image Stack Projection'Thermo FisherDesktopWindows, Mac OS X, LinuxProprietary
CamRangerCamRangerDesktop / MobileiOS, Android, Mac OS X, WindowsProprietary
Chasys Draw IESJohn Paul ChachaDesktopWindowsProprietary
CombineZAlan HadleyDesktopWindowsGPL
CUVI Vision & Imaging LibraryTunaCodeDesktop / EmbeddedWindows, LinuxProprietary
Enfuse (combined with align_image_stack or similar)Andrew Mihal and hugin development teamDesktopMultiplatformGPL
FocusFusionDelphiToolsDesktopWindowsProprietary
Focus StackerAlexander Boltnev, Olga KacherDesktopMac OS XProprietary
Focus Stacking OnlineFocus Stacking OnlineWeb applicationAllProprietary
Helicon FocusDanylo KozubDesktopWindows, Mac OS XProprietary, 30-day trial
ImageJ with Extended Depth of Field PluginAlex Prudencio, Jesse Berent, Daniel SageDesktopUnix, Linux, Windows, Mac OS 9 and Mac OS XPublic domain
MacroFusionDariusz DumaDesktopLinuxGPL
Mathematica via ImageFocusCombineWolfram ResearchDesktop / WebWindows, Mac OS X, LinuxProprietary, 15-day trial
Open GalileoBrandon Antonio Segura TorresDesktopWindowsFree and open-source software
PicolayHeribert CypionkaDesktopWindowsFreeware
QuickPHOTO with Deep Focus extensionPromicraDesktopWindowsProprietary, 30-day trial
Shine StackerLuca ListaDesktopWindows, Max OS X, LinuxLGPL
Shutter Stream Product Photography SoftwareIconasysDesktopWindows, Mac OS XProprietary
Zerene StackerRik LittlefieldDesktopWindows, Mac OS X, LinuxProprietary, 30-day trial
::

Gallery

Pictures

File:Zassenhaus pepper mill - underside view - grinder (2019-08-06).jpg | Pepper mill, stack of 28 frames File:Electric guide 3×2.5 mm.jpg | Stacked image of 3 × 2.5 mm electric wires File:Philips Series 7000 shaver head.jpg | Shaver head, stack of 36 frames, retouched File:Macrolepiota procera Parasol -20191014-RM-165319.jpg | Macrolepiota procera, stack of 15 frames File:Orchideenblüte 2019-05-22 11-34-28 (C)-PSD.jpg | Stacked image of the inner ridge of an orchid blossom File:Two Arecaceae in the fields viewed through a hole in a tree trunk in Laos at golden hour.jpg | Stacked image of two Arecaceae viewed through a hole in a tree trunk File:2013-06-07 14-57-13-bille-32f.JPG | Pellet, stack of 32 frames File:2016-01-06 14-51-04 parc-tete-or 10f.jpg | Alluaudia comosa, stack of 10 frames File:2013-12-28 19-51-33 Litchi-20f.jpg | Mold on Litchi chinensis, stack of 20 frames File:Skull (front) - Dolmen de Marie Gaillard MHNT ANT 2017 0 54.jpg | Skull, stack of 6 frames File:Sympetrum flaveolum male - Kulna.jpg| Sympetrum flaveolum male, stack of 36 frames File:Pinot_Grigio-20201027-RM-114053.jpg| Pinot Gris grape, stack of 12 frames.

Videos

File:Hindesite - Lily - Focus Stacking (by).ogv|Focus stacking images of a lily File:Focus stacking NEC USB chip imgp0017 wp.ogv|Focus stacking images of a microchip

Diagrams

File:Stack and Stitch Illustration.png | Software creates from the sharpest areas in a stack of sections.

References

References

  1. "Malin Space Science Systems - Mars Science Laboratory (MSL) Mars Hand Lens Imager (MAHLI) Instrument Description".
  2. "FOCUS STACKING & BRACKETING WITH OM-D".
  3. Johnson, Dave. (2008). "How to Do Everything: Digital Camera". McGraw-Hill Osborne Media.
  4. Ray 2002, [https://books.google.com/books?id=cuzYl4hx-B8C&pg=PA231&dq=multi-plane-scanning 231–232]
  5. "Afficher le sujet - Proposition d'un terme français pour "focus stacking" • Le Naturaliste".
  6. "Malin Space Science Systems - Mars Science Laboratory (MSL) Mars Hand Lens Imager (MAHLI) Instrument Description".
  7. "MSL Science Corner: Mars Hand Lens Imager (MAHLI)".
  8. (2010). "Extended Depth of Field for High-Resolution Scanning Transmission Electron Microscopy". Microscopy and Microanalysis.
  9. (2013-03-14). "Focus Stacking Made Easy with Photoshop".
  10. (2018-03-30). "Avizo User Guide, Module "Image Stack Projection"".
  11. "Focus stacking online - free online focus stacking application".
  12. (27 November 2016). "GUI to Combine Photos to Get Deeper DOF or HDR".
  13. "ImageFocusCombine".
  14. "Shine Stacker".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

articles-containing-video-clipsdigital-photographyimage-processingphotographic-techniques