This section is a bit technical, but gives a rough idea of how the 2 systems operate.
Contrast detect AF works by trying to maximise the contrast (the sharpness of the change from light to dark) in a small area around the chosen focus point. The image below shows two rectangles with low contrast and high contrast edges – it’s easy to see that maximising the edge contrast brings this point of the image into the best focus:
The only way this contrast maximum can be found is to try adjusting the focus of the lens in one direction and see if it makes the contrast better or worse, then keep moving in the direction that improves the contrast until it doesn’t get any better (i.e. just past the perfect point).
As long as the part of the image being analysed has enough contrast, the analysis algorithm usually works well. The focus movement algorithm can be quite clever – analysing changes and moving in variable size steps to get to the best point as quickly as possible. Some cameras even know about the characteristics of the lens attached and can make assumptions to work even quicker (for example, Panasonic’s DFD technology).
In most DSLRs, Phase Detect AF works with a separate sensor which consists of various lens elements and some linear light sensors (i.e. arranged in a line, rather than a rectangle like the main image sensor). Two light paths from opposite sides of the lens are routed via mirrors and lenses to the AF sensor which then compares the two images.
In the picture below, the dotted line shows the light path coming from the lens, going through a semi-transparent region of the main mirror and hitting the secondary mirror behind, then travelling down to the AF sensor assembly at the bottom of the camera:
Typical DSLR mirror and autofocus sensor arrangement
What ends up at the 2 sensing regions of the AF sensor is a pair of lines (one from each side of the lens) of light and dark areas, one offset a little when compared to the other:
A correlation operation is performed which finds out how much you have to move one waveform past the other (and in which direction) in order to get the best match, for example:
By comparing the two waveforms and working out how much to move one compared to the other, the AF sensor and processor can immediately determine two things before any movement of the lens:
This information can then be used to drive the lens by an appropriate amount and in the appropriate direction to get good focus (in reality, it gets to roughly the right place, then the process is repeated a few times to get to a suitable accuracy). Because the comparison of the two images gives you both an amount to shift and a direction, the lens can be quickly moved to approximately the right place – this is what makes phase-detect AF much quicker than contrast detect.
With the release of the J1 and V1 back in 2011, Nikon claimed the “world's first interchangeable lens digital cameras equipped with focal plane phase detection AF”.
What Nikon did was to replace some of the standard light-sensing pixels on the image sensor with special pixels which could detect light from different paths. By using the two sets of data from a strip of these pixels, a phase detect focus operation can be performed in much the same way as described above. In most cases, these phase-detect sensing elements don’t detect the image data, so the camera needs to “fill in the blanks” in the image, resulting in a slight drop in overall image quality around these areas.
Focal-plane phase-detect autofocus is not as accurate or fast as using a separate phase-detect sensor, but when combined with contrast-detect autofocus in a hybrid system it can increase overall autofocus performance and extend the light-level range at which the system can work.
Nearly 10 years later, many manufacturers now use on-sensor phase detect pixels, but Canon have taken this technology one step further with their Dual-Pixel Autofocus. Instead of dedicating certain areas of the sensor to phase-detect autofocus, Canon have split every single pixel on the sensor in half so they all see light from two directions. With this system, autofocus can be performed at almost any point on the sensor, with the actual image being created by combining the results of the pixel pairs at each point. This is really cool technology!
Continue on to Why do you need Microadjustment?
An Introduction to Autofocus | This Page | Why do you need Microadjustment?