Chapter 5 · Pinhole, lens and sensor, from antiquity to today
The camera
The dark room with a hole
Camera obscura is Latin for dark room. Make a small hole in the wall of a dark room, and on the opposite wall appears an upside-down picture of the world outside. The reason is that light travels in straight lines, so rays from the top of a tree pass through the hole and land low on the wall. The Chinese thinker Mozi wrote about it in the 5th century BC, and Ibn al-Haytham explained it in his Book of Optics around 1021. A smaller hole gives a sharper but dimmer picture.
A lens is a thousand holes
A lens bends light so that all the rays leaving one point of an object meet again at one point behind it. It gathers far more light than a pinhole and still keeps the picture sharp. The distances follow the thin lens rule 1 / f = 1 / u + 1 / v, where f is the focal length, u the distance to the subject and v the distance from lens to sensor. A bigger opening collects more light, so the picture can be taken in less time. That is the whole reason cameras have lenses.
Focusing, worked out
Take a lens with f = 50 mm and a subject 2 m away, which is 2,000 mm. Then 1 / v = 1 / 50 − 1 / 2,000 = 39 / 2,000, so v ≈ 51.3 mm. A very distant subject would need v = 50 mm. To focus on the nearer subject the lens moves 1.3 mm away from the sensor. Focusing is just moving a lens by about a millimetre, and a phone does it with a tiny motor. The first permanent photograph was taken by Nicéphore Niépce around 1826, and the exposure took many hours.
A million buckets of light
The sensor is a chip covered with millions of tiny light-sensitive cells, the pixels. A particle of light, a photon, hitting silicon knocks an electron loose. Each pixel counts the electrons it collects, like a bucket collecting rain. Most sensors today are CMOS. The CCD, invented by Willard Boyle and George Smith in 1969, earned them a share of the Nobel Prize in Physics in 2009. A 12-megapixel sensor has 12 million pixels, for example 4,000 columns and 3,000 rows.
Colour from a mosaic
A bucket can count light but cannot tell its colour. So each pixel sits under a tiny red, green or blue filter, in a pattern invented by Bryce Bayer at Kodak in 1976. In every block of four pixels there are two green, one red and one blue. Green gets twice the room because human eyes are most sensitive to green. The camera then guesses the two missing colours at every pixel from its neighbours, a step called demosaicing.
Aperture: the size of the opening
The aperture is the adjustable opening in the lens. It is written as an f-number N, the focal length divided by the opening's diameter. A 50 mm lens at f/2.8 has an opening of about 18 mm. Each full step of the series f/2.8, f/4, f/5.6 halves the light, because the area of the opening halves. A wide opening, a small number, gives bright pictures and a blurred background. A narrow opening gives dimmer pictures with more of the scene sharp.
Shutter and ISO trade-offs
The shutter decides how long light is collected, for example 1/100 s. A long time makes pictures brighter but turns fast movement into blur. ISO amplifies the signal after the light is counted: doubling ISO doubles the brightness, and also the noise. The three dials trade against each other. Going from f/2.8 to f/5.6 is two steps, a quarter of the light, so to keep the same brightness 1/100 s must become 1/25 s, four times longer. Move all three sliders in the sandbox and watch brightness and blur change.
A picture made of numbers
Each pixel stores three numbers, for red, green and blue, from 0 to 255, one byte each. That gives 256 × 256 × 256 = 16,777,216 colours. White is (255, 255, 255), black is (0, 0, 0) and pure red is (255, 0, 0). A 12-megapixel photo is 12 million × 3 bytes = 36 million bytes before compression. JPEG squeezes it about ten times, to 3 or 4 MB, by dropping detail the eye hardly notices. A photo is a spreadsheet of numbers, and editing it is arithmetic.
In numbers
- 16,777,216
- colours from three 8-bit numbers per pixel
- 2 : 1 : 1
- green, red and blue filters in each Bayer block
- 1 stop
- one f-stop, f/2.8 to f/4, halves the light