[Written for Better Digital Photography magazine, 2004]

 

How does autofocus work?

 

All digital cameras have autofocus systems to ensure a sharp picture. Some are more sophisticated than others, but all of them operate on the same basic principals, so how do they work?

 

Autofocus systems for cameras have been around since the introduction of the revolutionary Minolta 7000 35mm SLR in 1985. The AF systems used on the majority of today’s digital cameras use exactly the same technique to determine if your picture is sharp.

 

Contrast detection AF

In a film camera, light from the lens is directed onto a special CCD sensor, consisting of a strip of light-sensitive cells usually 100 pixels long, but only a single pixel wide, positioned at the centre of the frame. This sensor’s job is to detect contrast. As you can see from figure 1, an out-of-focus image produces an image in which the contrast between adjacent pixels is low. When the picture is in focus (figure 2), the contrast between pixels is high. Using motors built into the lens, the camera automatically adjusts the focus until the contrast across the sensor strip is maximized. This is why autofocus systems work best on subjects that have lots of detail, and find it difficult to lock on to subjects that have few contrasting edges or are poorly lit.

Of course, digital cameras have a CCD sensor for taking the picture, so the autofocus system in a digital camera uses this. It samples the image from the CCD at a single point, but basically operates in exactly the same way, measuring contrast and adjusting the lens to produce a sharp image.

 

Phase-difference AF

An alternative to contrast detection autofocus, phase-difference AF works by splitting a beam of light coming in through the lens into two, and then focusing these beams onto a sensor. If the image is out of focus, then the light waves in these two beams will be out of phase with one another. The camera’s processor can detect the degree of difference between the beams, and from this calculate how far the lens needs to move in order to bring the image into focus. This system is often used in conjunction with a contrast detection system in what is known as a hybrid AF system, which is found on some of the latest digital cameras, such as the Casio Exilim EX-600.

 

Multi-point AF

One problem with AF systems is that they can easily be confused by objects in the foreground. You’ve probably noticed this yourself. Try to take a photo through the branches of a tree, and the camera will focus on the branches rather than your subject. Some more recent camera compensate for this by using more sophisticated AF systems that take readings from several different positions on the sensor, and by following special programming can determine what is likely to be the subject. Some systems can even track moving objects. This is known as Dynamic AF. Often these systems can be over-ridden, so that the user can pre-select a position in the frame to be the AF point, such as the system found in the Minolta Dimage A1 and A2. This is very useful for unusual compositions.

 

AF illuminators

Since contrast is dependent on illumination, autofocus systems find it difficult to operate in low light levels. Try to take a photo with insufficient light and you’ll notice that your camera will “hunt”, focusing in and out to try and get a lock on an area of contrast.

Some cameras get around this problem by having a small but powerful lamp built into the front of the camera, which can provide enough light for the autofocus system to operate, at least over a limited range. Often this is simply a white light, but some cameras project a pattern of red lines onto the subject, providing a contrasting pattern for the AF system to lock onto. Sony’s high-end digital cameras, such as the DSC-F828 have AF illuminators built in. Some camera-mounted flashguns also incorporate an AF illuminator.

 

Active AF systems

One of the earliest AF systems, found on old Polaroid instant cameras, used an ultrasonic pulse like a submarine’s SONAR system to measure the distance between the camera and the subject. The sound bounced off the subject and by measuring the delay between sending the pulse and receiving the echo, the distance could be calculated. The major drawbacks with this system were that it would only work if the subject was relatively close to the camera, and also it could not be used through a window, since the sound would be reflected by the glass.

Another type of active AF uses a similar principal, but instead of ultrasound it shoots a beam of infrared light at the subject. This system is little used these days, since contrast detection and phase difference systems are far more reliable.