3.3 Focus, autofocus, and depth of field⧉
Focusing, from the thin-lens chapter, is nothing more than choosing the image distance $v$, by moving the lens so the subject's image lands exactly on the sensor. Doing that automatically, fast and accurately, is autofocus (AF), and there are two classic passive families plus a modern on-sensor synthesis (Figure 3.3.1).
Contrast-detection autofocus (CDAF) drives the lens until the image contrast (sharpness) is maximal. It is accurate because the peak of the sharpness curve is exactly best focus, but it has to hunt: from a single blurred frame it knows only that the image is soft, not which direction sharpens it, so it must dither past the peak to find it. Historically slow, it was the staple of early mirrorless bodies and compacts.
Phase-detection autofocus (PDAF) is cleverer. It looks at the scene through two opposite edges of the lens, two sub-apertures, giving two slightly shifted views of the same scene. The phase difference between them gives the direction and the amount of defocus in a single shot, so the lens drives straight to focus with no hunting (Figure 3.3.2). This is literally a tiny stereo measurement (the two sub-apertures are a micro baseline), and it is why the next chapter's stereo geometry shows up inside a single camera. The classic single-lens reflex (SLR) implemented PDAF with a dedicated AF sensor hidden under the reflex mirror.
On-sensor PDAF and dual-pixel is the modern synthesis that mirrorless bodies use. Instead of a separate AF sensor, phase detection is moved onto the imaging sensor itself, either with scattered masked AF pixels, or with dual-pixel designs that split every photosite into two halves that see opposite sub-apertures. The result is phase detection at nearly every pixel, the speed of PDAF with the coverage of CDAF, combining both advantages. (Those same split photosites are a literal micro-stereo pair, which is how Google's Pixel computes the depth for its portrait-mode background blur.) For completeness, active AF, such as old Polaroid sonar (ultrasonic time-of-flight) and infrared rangefinding, works in the dark but is crude; it is distinct from an AF-assist lamp, which merely throws contrast onto the subject so passive AF can work.
Depth-from-defocus AF (Panasonic DFD) is a third route that wrings a one-step focus cue out of an ordinary contrast sensor. There are no phase pixels at all. The trick is to model how a particular lens blurs: knowing its point-spread function as a function of focus, the camera shoots two frames at slightly different focus and reads off, from how the blur changes between them, both the direction and the amount of defocus. That is a PDAF-like single-step estimate sitting on top of a plain contrast sensor. It still rides on CDAF for the final confirmation, and it needs a per-lens blur profile baked in (so it works only with the maker's own lenses). The full treatment of how defocus encodes depth is deferred to the Optics part (Focus).
Focus modes decide whether to lock or track: AF-S / one-shot locks focus once, for still subjects; AF-C / AI-Servo tracks continuously and even predicts motion, for action. Increasingly, what to focus on is itself automated: from single-point and zone selection, cameras have moved to subject-detection AF that finds and tracks a face → eye → animal / bird / vehicle with a deep-learning detector (→ Machine learning). Eye-AF is the headline modern feature for portraits: the camera locks the nearest eye and holds it as the subject moves. Two handling tricks round out the section: back-button focus decouples AF from the shutter button (focus with a thumb button, release with the shutter), and focus-and-recompose locks focus on the subject, then reframes; but beware the small focus-plane error this introduces at wide apertures and close range, where depth of field is razor-thin.
Manual versus automatic. The optical machinery under all of this — how phase detection reads the two pupil edges, how defocus itself encodes distance, and how the focus motor drives the elements — is developed in the OPTICS part (Focus and Autofocus, §10.8 and §10.9); here we stay in the photographer's chair. Autofocus is right for almost everything now, but manual focus still wins in the cases AF struggles with: very low contrast or repetitive texture (nothing for phase or contrast detection to lock onto), shooting through glass, a fence, or foliage (AF grabs the obstruction), macro (where you focus by rocking the whole camera, not the ring, and depth of field is paper-thin), astrophotography on stars, and deliberate focus pulls in video. Most lenses allow full-time manual override, and mirrorless bodies make manual focus practical again with the electronic aids below. A related control on long telephotos and macro lenses is the focus limiter, a switch that restricts the range AF will search (say, "far only," or a macro-only near band): by forbidding one extreme it stops the lens from racking its whole long travel hunting past the subject, which is often the difference between catching a bird and watching the lens search while it flies off.
3.3.1 Manual-focus aids: making the focal plane visible⧉
Before autofocus, the photographer supplied the focus decision by eye, aided by a family of optical cues engineered to make defocus visible. They are worth knowing both as history and because their working principles reappear, mechanized, in the phase-detection autofocus above (Figure 3.3.3). The aids fall into two camps by where they judge focus: through the taking lens (the SLR's focusing screen) or through a separate optical baseline (the rangefinder).
Ground glass and the matte field. The oldest aid is to look at the image the lens actually forms. Put a diffusing surface, a piece of finely ground glass, at the film plane, and the lens projects its picture onto it; the matte texture catches the aerial image and scatters it toward your eye, sharp where the lens is focused and smeared where it is not. This is how a view camera is focused, on a ground-glass back under a dark cloth, and it is what sits, shrunk, at the top of an SLR: the reflex mirror bounces the image up onto a small focusing screen viewed through the pentaprism, an in-camera ground glass. The whole matte field is a focus aid, you can judge sharpness anywhere on it, which is its virtue over the spot aids below. The brightness of that screen is set by the lens's maximum aperture: an SLR views wide open (stopping down only at exposure) so the screen is bright and its depth of field shallow, which is what makes focus snap visibly in and out; a fast $f$/1.4 lens gives a brilliant screen, a slow $f$/8 zoom a dim one with so much depth of field that nothing looks clearly out of focus.
The split-image rangefinder. The cleverest screen aid is the split prism at the center of many SLR screens: a pair of opposed wedge prisms that shear the image into two halves. Each wedge collects light from one side of the lens's exit pupil, so the two halves are effectively viewed from opposite edges of the aperture, a built-in stereo baseline inside a single lens. At exact focus the two half-images line up; off focus they slide apart, and you turn the focus ring until a broken line snaps back into one. It is a disparity device, and a direct optical ancestor of the phase-detection autofocus above, which does the same edge-of-the-pupil comparison with a sensor instead of an eye. This is where the aperture constraint bites hardest: because each wedge takes light from the edge of the pupil, with a lens slower than about $f$/5.6 (or a fast lens stopped down) one half of the split goes black, and the aid fails exactly when you most want it, which is why split-image screens are matched to fast lenses and faded as slow consumer zooms took over.
The microprism collar. Ringing the split spot on many screens is a microprism annulus, a dense mosaic of tiny facets each acting as a minute split prism. An out-of-focus image striking it is shattered into a coarse, shimmering scintillation; as you approach focus the shimmer abruptly resolves into a clean image. Where the split prism gives a precise vernier-style line-up, the microprism gives a fast, whole-area "it snaps" cue. It shares the split prism's Achilles heel: the facets need light from across a wide pupil, so the collar too dims and stops working with slow or stopped-down lenses.
The coincidence rangefinder. The other camp judges focus outside the taking lens. A true rangefinder camera (the classic Leica) triangulates the subject with a separate optical baseline: two windows a known distance $B$ apart feed a central patch in the finder where the two views are superimposed, and a beam-splitter and a cam coupled to the focus ring rotate one view until the double image in the patch merges into one. Bringing the images into coincidence is solving the stereo geometry $Z = fB/d$ by hand. Because it does not look through the taking lens, a rangefinder is bright and precise even with a slow lens and in dim light, and it is unbeatable for wide lenses, but it cannot show depth of field, suffers parallax, and grows inaccurate for long telephotos where the baseline is too short.
Electronic aids. Modern electronic finders replace all of these with computed cues: focus peaking outlines the highest-contrast (sharpest) edges in a bright color, since in-focus edges carry the most high-frequency energy, and a magnified live view blows up a patch to check critical focus directly. They need no wide aperture and no moving prisms, but they are the same idea, making the invisible thinness of the focal plane visible, carried out in the sensor and the processor rather than in glass.