AI Glossary / Computer vision and multimodal AI / Beginner

Focal stacking

Definition

Focal stacking, commonly called focus stacking, combines photographs taken at different focus settings into a composite with a greater range of apparently sharp subject depths. Each source image contributes regions that are suitably focused, allowing the result to show more of the scene sharply than one capture may permit.

What it means

A lens does not render every subject distance equally sharp at one focus setting. This is especially noticeable in close-up photography, where a small change in depth can move part of the subject outside the usable depth of field.

A focus stack captures complementary sharp regions by adjusting focus between images. Software aligns the photographs, identifies useful areas and blends them into a composite. The subject ideally remains still throughout the sequence.

The method does not make an individual exposure acquire unlimited depth of field. It creates a new image from several observations. That distinction matters when the image is used for measurement, documentation or any purpose where the capture process should remain clear.

How it works

The capture sequence steps focus through the relevant subject range, with enough overlap between acceptably sharp regions. Consistent framing, illumination and exposure make later processing easier. Some workflows change lens focus, while others move the camera or subject in a controlled way.

Processing first aligns the images because focus changes and small movements can alter framing or apparent scale. A focus measure estimates which regions contain useful sharp detail. Masks or weights then select and blend contributions.

Occlusion boundaries, fine hairs, transparent materials and changing reflections can be difficult. A blurred foreground object may spread across a background region in some source frames. Automatic blending therefore needs inspection and sometimes manual correction or recapture.

Three practical examples

1. Product photography: A jeweler photographs a stationary ring at several focus settings so that the front setting and rear band can both appear sharp in the final image.

2. Nature documentation: A photographer combines a sequence of a still specimen. Movement between frames can make a living subject or wind-blown plant unsuitable for a simple stack.

3. Technical illustration: A team creates a detailed image of a small mechanical assembly. It retains the source frames so reviewers can distinguish captured detail from compositing decisions.

Think of it this way

Think of reading a long sign through a small clear window, moving the window to view different sections, and assembling the clear sections into one view. Each observation contributes something the others do not show as clearly.

The analogy is limited because camera blur is not a neatly bounded window. Out-of-focus content overlaps neighboring areas, and alignment or occlusion can prevent a clean selection of independent sharp pieces.

Worked example

Imagine three source photographs focused on the front, middle and rear of a small object. At one image location, an illustrative sharpness measure returns scores of 8, 20 and 5. A simple selection rule would choose the middle-focus image at that location.

At another location, the scores are 18, 9 and 4, so the front-focus image would be preferred. Repeating such decisions suggests how different parts of the final composite can come from different captures.

Actual stacking is more complicated than taking the largest isolated score. Noise can mimic fine detail, abrupt selections can create seams, and neighboring pixels should often be treated coherently. The invented scores are not a universal focus metric, and a high score does not independently prove that the selected region is an accurate representation.

Illustrative case study

Fictional case: Maple Miniatures prepares catalog photographs of hand-built models. One exposure leaves the nearest details sharp but the rear features soft. The photographer captures a focus sequence and creates a composite.

A thin antenna develops a halo because its blurred appearance affects neighboring background pixels in several frames. The editor checks the source images, refines the affected mask and recaptures another model that moved during the sequence. The team records the result as a focus-stacked photograph and keeps the originals. This scenario illustrates quality control without claiming a particular number of frames guarantees success.

Common misconceptions and mistakes

Focus stacking is not the same as averaging repeated frames for noise reduction. Its central purpose is to combine regions focused at different depths.

It is not automatically a depth measurement. Some methods can derive focus-related depth information, but an attractive composite alone is not a calibrated depth map.

More frames do not guarantee a better result. Poor alignment, motion or unnecessary inconsistent captures can create additional problems.

A composite cannot supply trustworthy sharp detail from a region that is blurred or hidden in every source. Stopping down the aperture and stacking are also different tools, each with optical and practical trade-offs.

Business use

Focus stacking can improve how small products, specimens and assemblies are presented when a stationary setup is available. It can reduce the need to compromise between which parts appear sharp, but adds capture, storage and review work.

Plan the subject range, required output resolution and acceptable compositing effort. Test representative materials, particularly glossy, transparent and very fine structures. For measurement or documentary uses, preserve provenance and assess whether the compositing process changes features important to the intended interpretation.

People also ask

Does focus stacking require special AI software?

No. Classical alignment, focus measures and blending can perform the task. Some products may add learned components.

Is a tripod enough to prevent all problems?

No. Subject movement, focus-related scale changes and occlusion effects can remain even with a stable camera.

How many images are needed?

There is no universal count. It depends on depth of field, subject depth, focus spacing and the required sharpness.

Check your understanding

The rear corner of an object is out of focus in every photograph in a stack. Can ordinary focus stacking reliably make that corner sharp?

Answer: No. The stack lacks a suitably focused observation of that region. The appropriate remedy is usually to capture additional suitable source imagery, rather than treating a sharpened or inferred result as recovered original detail.

Related terms

  • Image registration
  • Image fusion
  • Computational photography
  • depth of field
  • focus bracketing
  • focus measure
  • focal plane

Learn next

Photograph a stationary object at several focus settings and identify which parts are sharp in each frame. Compare a simple selection composite with a blended result. Inspect boundaries at full resolution and learn how focus spacing, alignment and source-frame coverage affect the final image.

More in Computer vision and multimodal AI

  • FFT solver - An FFT solver is a numerical solution method that uses the fast Fourier transform to simplify a suitably structured problem.
  • Fitness function - A fitness function evaluates how well a candidate solution meets the goals of an optimization task.
  • Flash / no-flash photography - Flash / no-flash photography uses a pair of images of the same scene, one captured with flash and one using ambient light, to support a combined or improved...
  • Focus peaking - Focus peaking is a camera or display aid that highlights image edges judged likely to be in focus.
  • Forensics - Forensics is the systematic examination of evidence to investigate what happened and support justified conclusions.
  • Forward mapping - Forward mapping is an image-warping approach that takes locations in a source image and calculates where they go in a destination image.

Sources

Primary documentation: Adobe, “Create composite images with extended depth of field,” https://helpx.adobe.com/ca/photoshop/desktop/create-masks/blend-images/create-a-composite-with-extended-depth-of-field.html . Additional Adobe explanation: https://www.adobe.com/creativecloud/photography/discover/focus-stacking.html . Relevant returned descriptions of stacking differently focused images were reviewed. The sharpness scores and company scenario are original teaching examples.

Previous: FMLLR Next: Focus groups

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer