AI Glossary / Computer vision and multimodal AI / Advanced

Shape from defocus

Definition

Shape from defocus estimates scene depth or surface shape from the way optical defocus changes image appearance. It relates observed blur to camera settings and an imaging model, often using multiple images captured with different focus or aperture conditions. The method uses blur as a depth cue rather than treating all blur simply as an unwanted defect to remove.

What it means

A point away from the focused distance can spread over a larger image region. With suitable calibration and observations, that spread contains information about depth. However, a blurry region does not uniquely identify a distance by itself. Scene texture, motion blur, noise and optical behavior can complicate interpretation, and similar defocus can occur on opposite sides of the focused plane. Recovering shape therefore requires more than assigning greater distance to every region that looks less sharp.

How it works

An imaging model connects depth with the point-spread function under known capture settings. A method estimates blur or relative blur between observations and uses that relationship to infer depth. Additional images, optical design or prior information can help resolve ambiguities. Calibration, image alignment and focus-related magnification changes matter when comparing captures. Uniform regions may provide little usable blur evidence unless additional structure is introduced. Depth boundaries also complicate simple local convolution models because neighboring scene points need not lie at the same distance or share the same visibility.

Three practical examples

  • A laboratory imaging system compares differently defocused captures of a textured surface to estimate its depth variation.
  • A computer-vision exercise tests how blur estimates change when the same patch is observed under two calibrated settings.
  • A measurement study checks whether added projected texture improves usable evidence on an otherwise smooth-looking surface.

Think of it this way

Imagine seeing a small light through a camera that is focused elsewhere. The light becomes a disk whose size changes as its distance changes. That disk is a clue, but without knowing the camera's configuration and which side of focus the light occupies, its size alone may not settle the distance. The analogy explains why defocus can carry geometric information while still requiring calibration and additional evidence for a reliable interpretation.

Worked example

In an original simplified calibration illustration, suppose blur size c in pixels follows c=10|1/z−1/2|, with z measured in meters. The coefficient 10 has the corresponding units needed for this stipulated relation, and the focused distance is 2 meters. If c=1, then |1/z−0.5|=0.1. This gives two candidates: 1/z=0.6 or 0.4, so z is approximately 1.67 or 2.5 meters. The example demonstrates a near - far ambiguity. It is not a universal lens formula or an actual camera calibration; another observation or constraint is needed to select between these candidates.

Illustrative case study

A fictional component-inspection team evaluates depth from defocus on textured test pieces. Results are promising on patterned areas but unreliable on a smooth patch and near a sharp depth discontinuity. The team examines confidence, calibration and capture alignment before deciding which regions can support measurement. It compares estimates with an independent reference rather than judging only the smoothness of the resulting depth map. This scenario illustrates a method with a defined operating range, not a claim that every visible surface yields accurate depth from the same pair of images.

Common misconceptions and mistakes

More blur does not universally mean farther away. The relationship depends on the focus setting and can be ambiguous around the focused plane. Another mistake is confusing defocus blur with motion blur or compression artifacts. A method that assumes a locally constant depth can also fail near boundaries. Shape from defocus is related to shape from focus, but the latter commonly searches a focus sequence for peak local sharpness. Finally, an attractive reconstructed surface does not establish metric accuracy, particularly when low-information regions were filled using smoothness assumptions or learned priors.

Business use

Defocus-based depth estimation can be useful when the capture system and scene meet its assumptions. Establish the required depth range, surface types and motion conditions, then validate against independent measurements. Monitor confidence and identify regions where texture or visibility is insufficient. Record optical settings and calibration changes because they affect the depth relationship. Compare the full capture-and-processing workflow with alternatives using the same practical requirements. The decision should rest on demonstrated measurement performance, not the general observation that blur sometimes varies with distance.

People also ask

Can one blur value imply two depths?

Yes, a magnitude-only cue can be ambiguous on opposite sides of focus.

Is this the same as deblurring?

No. The primary goal here is depth or shape, although some methods also reconstruct sharper imagery.

Do textureless regions always provide enough evidence?

No. They can make blur estimation difficult without additional information.

Check your understanding

What were the two toy depth candidates?

Answer: Approximately 1.67 and 2.5 meters.

Why were there two?

Answer: The absolute value removed the sign of the difference from the focused reciprocal distance.

Why should the equation not be applied directly to a phone photograph?

Answer: It was a stipulated teaching relation, not that camera's verified optical calibration.

Related terms

  • Point spread function
  • Shape from focus
  • depth from defocus
  • optical calibration
  • depth ambiguity
  • focus breathing

Learn next

Plot the stated toy blur relation on both sides of 2 meters and identify equal-blur pairs. Then consider how a second calibrated capture could distinguish them. Finally, list scene changes that would invalidate a simple shared-patch comparison before using blur to estimate depth.

More in Computer vision and multimodal AI

  • Semantic gap - The semantic gap is the mismatch between information represented or extracted by a computational system and the meaning people attach to that information in...
  • Separable filter - A separable spatial filter has a multidimensional kernel that can be expressed as a product of lower-dimensional kernels.
  • Shadow removal - Shadow removal is the process of producing an image or representation in which the effects of selected shadows are reduced or compensated for.
  • Shape from shading - Shape from shading estimates surface orientation or shape from brightness variations interpreted through a model of illumination and surface reflectance.
  • Shape grammar - A shape grammar is a formal system of spatial rules that generates or describes designs by matching and transforming shapes.
  • Sharpening - Image sharpening is processing that increases the apparent definition of edges or fine detail, often by strengthening selected local intensity differences.

Sources

Columbia University CAVE, Depth from Defocus project: https://www.cs.columbia.edu/CAVE/projects/depth_defocus/depth_defocus.php The reciprocal-depth calculation, blurred-light analogy and inspection case are original educational illustrations. Historical prototype results on the project page are not generalized into accuracy guarantees for other cameras, scenes or implementations.

Previous: Shape Next: Shape from focus

  • 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