Depth and Focus

Photography Fundamentals

Course 1 · Chapter 3 · Depth and Focus: Depth of Field and Autofocus

What Depth of Field Is

Only one distance is truly in focus, but a band around it looks acceptably sharp. Wikipedia's Depth of field article describes depth of field (DOF) as the distance between the nearest and the farthest objects that appear in acceptably sharp focus. Photography Fundamentals 1 noted that opening the aperture decreases depth of field; Photography Fundamentals 2 gave the focal length and sensor size. This chapter brings them together.

What Controls It

The article gives an approximate formula, DOF = 2 u squared N c / f squared, for subject distance u, f-number N, circle of confusion c and focal length f. The circle of confusion is the largest blur spot that still looks like a point. Reading the formula:

ChangeEffect on DOF (per the article)
Wider aperture (lower N)Reduces DOF; DOF grows in proportion to the f-number for a fixed framing
Subject distanceChanges with the square of the distance
Focal lengthChanges inversely with the square of the focal length
Circle of confusionChanges linearly with c
Sensor sizeWith focal length and aperture held constant, a smaller sensor reduces DOF by the crop factor
Approximation only
The article calls the formula approximate. It is a reasonable guide at ordinary distances, but I have not checked how far it drifts at very close range (check). The article's circle-of-confusion values (0.25 mm viewed from 25 cm; 0.025 mm for 16 mm film and modern 35 mm motion pictures) are not for stills cameras. The 0.03 mm I use below is a common convention for full-frame stills that this source did not confirm (check).

Trying the Formula

The script below applies the approximation. I ran it and the output is shown.

def dof(u, f, n, c): """Approximate depth of field in mm: 2*u^2*N*c / f^2""" return 2 * u * u * n * c / (f * f) c = 0.03 for u, f, n in [(2000, 50, 2.8), (2000, 50, 5.6), (2000, 50, 11), (4000, 50, 2.8), (2000, 100, 2.8)]: print(f"u={u/1000:.0f} m f={f} mm f/{n}: DOF about {dof(u, f, n, c)/1000:.2f} m")
# Output u=2 m f=50 mm f/2.8: DOF about 0.27 m u=2 m f=50 mm f/5.6: DOF about 0.54 m u=2 m f=50 mm f/11: DOF about 1.06 m u=4 m f=50 mm f/2.8: DOF about 1.08 m u=2 m f=100 mm f/2.8: DOF about 0.07 m
What the numbers show
Doubling the f-number doubles the depth (0.27 to 0.54 m). Doubling the distance quadruples it (0.27 to 1.08 m). Doubling the focal length at the same distance quarters it (0.27 to about 0.07 m). These match the proportions in the table above. Note the framing is not held constant in the last line: the subject would look twice as large.

Focus: Hyperfocal Distance

The article defines the hyperfocal distance as the distance beyond which all objects can be brought into acceptable focus, and gives maximum DOF. Focusing at that distance gives a DOF from half the hyperfocal distance to infinity. The commonly quoted formula H = f squared / (N c) + f was not in the part of the article I read, so treat it as unconfirmed (check).

Autofocus

From Wikipedia's Autofocus article: active systems measure the distance to the subject independently of the optical system (the article cites ultrasonic, infrared and time-of-flight methods); passive systems analyse the incoming image and need enough light and contrast.

Passive methodHow it worksTraits
Phase detectionSplits the light into pairs of images and compares themFast; gives direction and distance to move; common in SLRs
Contrast detectionAdjusts focus until contrast peaks in a sensor fieldCommon in cameras without reflex mirrors; slower, no direction, harder for moving subjects

Focus modes: single-shot (Canon "One-Shot", Nikon "AF-S") halts on focus confirmation. Continuous (Canon "AI Servo", Nikon AF-C) predicts a moving subject's position from its speed and acceleration, which suits sports and action. The article's description is general; how current mirrorless cameras combine the methods was not covered in my reading (check).

A practical choice
For a still subject, use single-shot and lock focus. For a moving subject, use continuous. Which one is better for a given situation is advice of my own rather than from the article (check).

Not Yet Verified, and Sources

  • Sources. Wikipedia articles Depth of field (read to about 100,000 of 112,055 characters; the last 12,000 were not read) and Autofocus (summary only).
  • Not confirmed. The 0.03 mm circle of confusion for full-frame stills, the hyperfocal formula, accuracy of the approximation at close range, and how modern autofocus combines methods (all check).

Exercises

Exercise 1

Using the script with c = 0.03, find the approximate DOF for a 35 mm lens at 3 m (3000 mm) at f/4 and at f/8. How does the result compare with the rule that DOF grows in proportion to the f-number?

Exercise 2

A portrait is taken at 2 m with a 50 mm lens at f/2.8. Without running the script, say what the DOF becomes if you step back to 4 m (and do not change anything else), and give the reason. Then confirm with the script output in the chapter.

Exercise 3

Choose single-shot or continuous focus, and phase or contrast detection if you had the choice, for (a) a still landscape and (b) a child running. Give one sentence of reasoning each, based on the autofocus table.

Quick Reference

  • DOF: about 2 u squared N c / f squared
  • More DOF: higher f-number, greater distance, shorter focal length
  • Phase detection: fast, gives direction
  • Contrast detection: slower, no direction
  • Modes: single-shot locks; continuous tracks
  • Check: circle of confusion for stills, hyperfocal formula
Coming next
Photography Fundamentals 4 turns to light: its direction, quality and the times of day that shape a picture.