There are many auto focus systems built into cameras and camcorders. Conceptually, they share the same fundamentals. The following is such a scheme. The camera lens projects the image onto the image sensor, the AF module retrieves a portion of the image for the CPU to process the contrast information, and the CPU activates the auto focus motor to move the lens for focusing based on the processing result. This process repeats until the subject is accurately focused on.
There have been many auto focus methods proposed, developed, used, and discarded in the past four decades. Currently, the two most popular ones are the contrast detection method and the phase detection method. The former has been superceded by the latter; however, it is being used in many consumer level digital cameras.
The contrast detection method is based on a fundamental principle: the accurately focused image has the highest contrast among all images of the same scene. Here, the term contrast is left undefined because it is very difficult to be defined precisely using folklore terms. Therefore, in a contrast detection method, the AF module (see the diagram above) extracts a portion of the image from the image sensor, process its contrast information with the help of the CPU, and moves the lens to focus. This process repeats until the recorded contrast is the highest, and the lens is focused. The extracted portion from the image sensor represents the auto focus area being used. Suppose the accurately focused image in the extracted portion is the following:
Suppose further the lens is out of focus initially. The extracted portion may be very similar to (a) below. During the focusing process, the extracted portion may go from (b) to (f), and eventually reaches a fully focused image as shown above. From these images, initially we (and the AF module) only see a very blurred image with very low contrast. As the lens moves to focus, the contrast level of the image increases. In fact, we can see some barely visible blurry lines in (d). The contrast between the dark color lines and bright color space becomes clearer in (e) and even better in (f). When the lens settles on the highest contrast image as shown above, auto focus completes.
Since this method requires contrast for focusing, the scene or the area used for focusing must have a reasonable contrast. Since low light implies low contrast, one major drawback of the contrast detection method is that AF may fail in a poorly illuminated environment and one must fine a high contrast area to focus. This is a major cause of the well-known focus failure problem of many digital cameras. The contrast detection method may also be defeated by a range of subjects with contrast gradients and/or repeated patterns.
If we look at the diagram in the beginning of this page, we will see at least the following components that can slow down the auto focus speed: (1), the time for the AF module to extract the portion in the image for auto focus; (2) the time for the CPU to process the contrast information; (3) the time for the CPU to instruct the motor to move the lens for focusing; and (4) the number of iterations the above steps must be repeated to get a focus lock.
Item (1) would not be a major problem in general, because it only involves retrieving a portion of the pixels from the image sensor. The retrieval speed is usually dictated by the image sensor access speed.
Item (2) has three major factors. First, the CPU processing speed. A slow CPU will process data slower. Second, although there are many contrast detection based systems around, they may not use the same algorithm in processing the contrast information. Efficient algorithms use less time. Third, contrast processing algorithms would usually be slower when the focus area has lower contrast. This is mainly the reason that an AF system work slower in low light and/or low contrast situation.
Items (3) may be crucial. Not all motors for driving lenses for focusing are created equal. Some are faster than the others. Moreover, lens design also plays an important role. Some lenses move a shorter distance than other lenses for the same focus request. Therefore, given everything being equal, the lens that moves a shorter distance focuses faster. This is the major driving force for camera and lens makers to design internal focusing (IF) and rear focusing (RF) systems and faster motors such as Nikon's AF-S silent wave motor.
In general, items (1) and (2) are electronic whose latency is generally shorter than the mechanical latencies such as moving the camera lens. Note that the situation may be worse if the lens is zoomed in because the maximum aperture may be reduced by about 1 stop (lower light, and hence lower contrast), and the focusing group of the lens may be forced to move a larger distance.
Based on the above discussion, let us see the other factors that can affect AF speed. In fact, these factors can also be considered part of the four items discussed earlier.