Depth from defocus (DFD) is a focusing technique that estimates subject distance from the amount of blur in images captured at slightly different focus positions, using a known optical model of the lens. Within Focus & autofocus in photography, DFD is best known as an extension of contrast detection AF that lets a camera on-sensor system predict the direction and distance to sharp focus instead of searching for it step by step.
The idea originated in computer vision research in the 1980s, where blur was treated as a measurable depth cue. Camera makers later adapted it to mirrorless bodies, most prominently in Panasonic Lumix cameras, to make contrast-based focusing faster without dedicated phase detection pixels.
How depth from defocus measures distance
Depth from defocus works by comparing two or more images of the same scene captured with the focus group in slightly different positions. A point that lies outside the plane of focus is spread into a blur disc, and the size of that disc depends on how far the point sits from the focus plane, the aperture and the focal length.
The camera stores a point spread function (PSF) profile for each compatible lens, describing how that lens blurs light at different apertures, focal lengths and focus distances. By measuring how the blur changes between the two frames and matching the change against the profile, the processor calculates an estimated defocus amount and its sign, which tells the motor whether to move toward infinity or toward the minimum focus distance.
The process runs as a fast closed loop. The following table summarizes the main stages and what each one contributes to the final focus decision.
| Stage | What happens | Result |
|---|---|---|
| Frame capture | Sensor reads two frames at nearby focus positions | Pair of differently blurred images |
| Blur comparison | Processor measures local sharpness change | Relative defocus per AF area |
| PSF matching | Change is matched to stored lens data | Distance and direction estimate |
| Fast drive | Focus motor jumps toward the estimate | Lens near correct focus |
| Contrast confirmation | Fine contrast peak search | Final, accurate focus |
The final step matters: in most implementations DFD provides a coarse but fast prediction, and conventional contrast detection performs the last precise adjustment. This hybrid behavior explains why DFD systems are usually very accurate once focus is locked.
Key parameters that affect DFD performance
The reliability of depth from defocus depends on how measurable the blur is and how well the camera knows the lens. Several optical and electronic parameters influence both speed and accuracy.
| Parameter | Typical influence | Practical consequence |
|---|---|---|
| Lens profile data | Required for accurate PSF matching | Unprofiled or adapted lenses fall back to plain contrast AF |
| Aperture | Wider apertures produce stronger blur differences | Estimates are often more decisive near maximum aperture |
| Sensor readout rate | Higher frame rates shorten each cycle | Faster acquisition and smoother tracking |
| Scene contrast | Blur is measured on edges and texture | Plain walls and fog weaken estimates |
| Light level | Noise masks fine blur changes | Slower or hesitant focus in dim interiors |
| Subject motion | Movement between frames distorts comparison | Possible misjudged direction with fast subjects |
Because the method needs lens-specific optical data, DFD is typically restricted to native lenses from the camera maker or partners in the same mount alliance. Third-party and adapted lenses often still focus, but without the predictive advantage.
How DFD compares with other autofocus methods
Depth from defocus sits between pure contrast detection and phase detection AF. It shares the sensor-based accuracy of contrast systems while borrowing part of the distance awareness that phase detection obtains optically.
| Method | Distance information | Main strength | Main weakness |
|---|---|---|---|
| Contrast detection AF | None, searches for peak | High accuracy, simple hardware | Slow, visible hunting |
| Depth from defocus | Estimated from blur and lens model | Faster contrast-based focus | Depends on lens data and texture |
| Phase detection AF | Measured directly from light angles | Fast tracking of moving subjects | Requires dedicated pixels or module |
| Hybrid autofocus | Phase data plus contrast confirmation | Speed with accuracy | More complex sensor design |
In practice, the most visible symptom of DFD is reduced but not eliminated focus wobble during video. Continuous autofocus may still show a small breathing-like pulse as the system checks contrast, which is why some videographers moved to cameras with on-sensor phase detection. Panasonic itself added phase detection to later full-frame and Micro Four Thirds bodies while retaining DFD-related processing.
Using a DFD camera effectively
Photographers get the best results from depth from defocus by giving the system clear blur cues and by choosing focus modes that match the subject. The following decision table summarizes practical settings.
| Situation | Recommended approach | Reason |
|---|---|---|
| Static subject, good light | Single autofocus with a small AF point | DFD plus contrast confirmation gives precise focus |
| Portraits | Face or eye detection | Detection narrows the area where blur is measured |
| Moving subject | Continuous AF with subject tracking and a focus limiter | Limits the search range and reduces direction errors |
| Video interview | Face detection with lowered AF sensitivity | Reduces visible pulsing between frames |
| Low-contrast scene | Target a textured edge or use manual focus | DFD needs detail to measure blur |
| Adapted lens | Manual focus with focus peaking | Predictive DFD data is unavailable |
Keeping firmware current is also worth the effort, because manufacturers have refined DFD algorithms and lens profiles through updates. A focus limiter on a telephoto lens reduces the range the system must evaluate and shortens acquisition time.
Limitations and common misconceptions
Depth from defocus is an estimation technique, so its weaknesses come from situations where blur stops being a reliable signal of distance.
- DFD is not phase detection. It infers distance from image blur rather than measuring it directly from separated light paths.
- Repeating patterns and low texture can make blur comparison ambiguous and cause hesitation.
- Fast erratic motion between the compared frames can lead to a wrong direction decision and visible hunting.
- Strong backlight and flare reduce contrast and degrade the blur measurement.
- Small apertures such as f/11 or narrower create deep focus zones with weak blur differences, reducing the value of the prediction.
A frequent misunderstanding is that DFD guarantees video focus without pulsing. It shortens the search considerably, but because confirmation still relies on contrast, subtle focus wobble can appear when the subject or lighting changes.
The idea in brief
Depth from defocus lets a camera judge distance by looking at how blurry things are. The camera takes two quick looks with the focus nudged slightly between them. If the blur grows or shrinks, the camera knows which way to turn the focus and roughly how far.
It is a bit like adjusting binoculars: once you notice the view getting sharper, you know which way to keep turning. The camera simply does this with stored knowledge of its lens, so it can jump close to sharp focus instead of searching slowly.
A practical scenario
A travel photographer uses a Micro Four Thirds camera with DFD and a native 12-60 mm zoom in a busy street market. Shooting at 25 mm and f/4, she selects single autofocus with face detection to capture vendors at work. The camera compares blur between frames, drives the lens almost directly to the right distance, and confirms with a brief contrast check, so focus locks in a fraction of a second with no noticeable hunting.
Later she mounts an adapted manual lens for a vintage look. Because the camera has no stored blur profile for that lens, the predictive advantage disappears, so she switches to manual focus with focus peaking. The difference shows clearly that DFD speed depends on native lens data, not on the sensor alone.