ArticleslgStudy

science

Focus stacking

Focus stacking is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Focus stacking rather than just read about it. In short: Focus stacking – also called focal plane merging, z-stacking, focus bracketing or focus blending – is 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…

Focus stacking — main illustration
Focus stacking — illustration

Key takeaways

  • Focus stacking belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Focus stacking to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Focus stacking from memory before moving on to harder problems.

Reference excerpt

Focus stacking – also called focal plane merging, z-stacking, focus bracketing or focus blending – is 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.

The Mars Hand Lens Imager (MAHLI) on the Mars Science Laboratory rover Curiosity can merge a focus stack of up to eight images on board, producing a color best-focus image and a grayscale range map.

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: Nikon gives calculated values of about 1.0 μm for a 40× objective with a numerical aperture of 0.65 and 0.19 μm for a 100× objective with a numerical aperture of 0.95. 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

Gallery

Pictures

Videos

Diagrams

See also

References

Ray, Sidney. 2002. Applied Photographic Optics. 3rd ed. Oxford: Focal Press. ISBN 0-240-51540-4. Brandon Antonio Segura Torres. «Release Open Galileo v1.0.0 · BrandonAntonioSeguraTorres/Open-Galileo». GitHub (en inglés). Consultado el 1 de enero de 2026.

External links

Which cameras have built-in focus stacking? by Jeff Meyer, Camera Jabber Nov. 2019.

Illustrations

Focus stacking: 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.
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: 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.
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.
Focus stacking: 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.
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.
Focus stacking illustration
Focus stacking illustration

Worked examples

Example 1 — a first encounter with Focus stacking

Start with the simplest possible case. Write down what Focus stacking claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Focus stacking before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Focus stacking ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Focus stacking

In research
Focus stacking appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Focus stacking in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Focus stacking is common in secondary-school and first-year university syllabi. It links to neighbouring topics Digital photography, Image processing, Photographic techniques, so understanding it makes those chapters shorter.
In everyday life
Look for Focus stacking outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Focus stacking” →

How to study Focus stacking in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Focus stacking means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Focus stacking out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Focus stacking in simple terms?

Focus stacking – also called focal plane merging, z-stacking, focus bracketing or focus blending – is 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 sourc…

Why does Focus stacking matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Focus stacking?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Focus stacking.

Tags

  • Digital photography
  • Image processing
  • Photographic techniques

Keep exploring