The thin lens
A pinhole has to be tiny to give a sharp image, so it collects very little light. A lens can have a large aperture of diameter and still be sharp, because it bends all rays from a scene point that pass through it onto one image point. For an ideal thin lens with focal length , a point at distance in front of the lens is imaged at distance behind it, with
A point at infinity is imaged at , closer points a bit farther behind the lens. The sensor is at a fixed distance behind the lens, so only points at one distance, the focus distance , are imaged exactly on it. Focusing a camera means moving the lens to change . The aperture is usually given as the f-number , written as f/1.8, f/8 and so on.
Circle of confusion
A point at another distance comes into focus at : in front of the sensor if it is farther away than , behind the sensor if it is closer. Its light forms a cone with the aperture as the base and the tip at , and the sensor cuts this cone in a disk. By similar triangles, the disk's diameter is . With the thin lens equation this becomes
- It is zero at and grows on both sides, faster in front of the focus distance than behind it.
- It is proportional to the aperture : half the aperture, half the blur (but also a quarter of the light).
- For a very distant background it approaches , so background blur has an upper limit.
Depth of field
No real image is perfectly sharp, so a small blur is acceptable. A common choice for the largest acceptable circle of confusion is , about 0.03 mm for a full-frame sensor. The range of distances where is the depth of field (also called depth of focus). Solving gives its limits:
When the denominator of is zero or negative, everything behind the focus distance is sharp enough. This first happens at the hyperfocal distance : focused there, the depth of field reaches from to infinity. A smaller aperture (larger f-number) increases the depth of field, and a larger one makes it shallower.
Smartphone vs large sensor
A smartphone camera and a full-frame portrait lens can have the same f-number, f/1.8, and thus collect the same light per area. But the phone's lens has mm, so its aperture is only mm across, while an 85 mm lens at f/1.8 has mm. Focused at 2 m, the phone keeps everything from about 1 m to 21 m sharp, and the portrait lens only about 5 cm around the subject:
- Smartphone: small aperture, large depth of field. Near and far objects appear in focus at the same time.
- Large-sensor camera (DSLR) with a wide aperture: shallow depth of field. The subject is isolated from a blurred background (bokeh).
The portrait modes of phones imitate the second look in software: they estimate a depth map and blur each pixel according to its depth, much like the layers in this demo.
Try this
- Start at 50 mm, f/2, focused on the subject: its circle of confusion is zero, while the foreground and the background are blurred.
- Stop down from f/2 to f/8. The aperture shrinks 4×, and so do all circles of confusion, while the depth of field grows from 18 cm to 74 cm.
- Focus on the background at 10 m. The foreground is now much blurrier than the background was before: the curve rises faster in front of .
- Press the smartphone preset: everything is sharp. Then press the full-frame portrait preset. Both are f/1.8.
- At f/8, press “Focus at the hyperfocal distance” and check that and .
- Move the background from 10 m to 100 m. Its blur hardly changes: it approaches .
- Keep the lens and switch to a smaller sensor. The acceptable shrinks with the diagonal, and so does the depth of field.