Autofocus – how it works

Anwendung:Background knowledge

The different types of autofocus explained: phase detection, contrast detection, hybrid autofocus. What technology is behind it, which camera types use what type of autofocus and what are their advantages and disadvantages.

Phase detection autofocus

How phase detection autofocus works

The principle | Phase detection autofocus established itself in analogue photography in the 1980s and has proven successful in modern digital SLR cameras to this day. Its performance has increased considerably, but it still works according to the original principle.

viewfinder with help for manual focusing, out of focus
viewfinder with help for manual focusing, in focus

It automates manual focusing, as it was common in SLR cameras: there were two semicircles in the center of the viewfinder that always show sharp image details due to an optical trick. If the lens is set to the correct distance, they fit exactly together, otherwise they appear shifted against each other.

DSLR cross-section with autofocus system

The modern implementation | Phase detection autofocus implements this principle with small, electronically analysed sensors. It is a small system of its own in SLR cameras, independent of the image sensor. A mirror directs the incoming light upwards to the viewfinder - but not all of it, it lets part of it pass and a second mirror sends it to the autofocus system.

It can tell from the difference between the two images in which direction and how far the lens needs to be adjusted for correct focusing; a tiny motor moves the distance ring of the lens precisely there.

One reading is enough | Phase detection autofocus has an advantage rooted in its technology that has made it superior for a long time: with one reading, the camera can immediately detect

  • in which direction and
  • and how far

the distance on the lens needs to be adjusted.

There needs to be contrast | The first example photo with the apple tree illustrates that the phase detection autofocus needs contrasts to work. Preferably a sharp edge running in the appropriate direction, across the two small partial images. Technical progress has addressed this limitation – more sophisticated sensors use four partial images and can respond to both vertical and horizontal contrasts. But on plain or blurry subjects they will fail too.

Sony's unique way: SLT | Sony's SLT cameras are, strictly speaking, not SLR cameras, as they work with an electronic viewfinder. They have a semi-transparent mirror that reflects light upwards to an autofocus module instead of the viewfinder. Unlike SLR cameras, this mirror is fixed and the camera can continuously access the image sensor like a mirrorless camera. This creates an image preview in an electronic viewfinder or monitor and the image sensor can support the autofocus - with the contrast detection autofocus described below. Sony has combined phase and contrast autofocus with this since 2010, but in 2021 these models will be phased out and the completely mirrorless cameras will take over.

Autofocus sensors in modern cameras

Number and location of autofocus sensors of various SLR cameras

Number and coverage | Technical progress and miniaturisation have made it possible to accommodate a whole range of such sensors in modern cameras. The next chart shows how they have increased over the years. In the meantime, however, the development seems to have come to an end. There have hardly been any new SLR models in recent years and the mirrorless system cameras that are replacing them work with hybrid autofocus  see below.

    Regular and cross-type sensors | A regular sensor needs contrasts in a certain direction, horizontally or vertically, sometimes diagonally. Cross-type sensors are the more sophisticated ones that can respond to contrasts in both directions. With technical progress, the number of cross sensors has also increased. Of the cameras shown as examples, the top-of-the-line models from Canon and Sony have exclusively cross sensors, the Nikon D850 has 99 of its 153 sensors.

    However, it is still true that it is not possible to work completely without contrasts; even the modern systems fail e.g. on a contrastless white wall.

Light sensitivity | It is astonishing how precisely the phase detection autofocus works with so little light. It only receives a part of the incident light that passes through the main mirror and each individual sensor uses only a tiny section of the image. With weaker lenses, however, the phase detection autofocus can reach its limits and, for example, no longer function from a maximum aperture of 8.

    Light sensitivity has also increased over the years, according to Nikon / Canon / Sony their systems still work down to a brightness of -3 or even -4 EV. That is really dark... -3 EV is the brightness at which a camera with aperture 2.8 and ISO 100 will expose for a full minute.

    Precise calibration necessary | Due to the nature of the system, the phase detection autofocus can only do its job precisely if the small autofocus system and the associated mirror are very accurately calibrated. Minimal mechanical movements can make it somewhat inaccurate. This is called "front focus" or "back focus" and results in the autofocus constantly focusing a little too close or a little too far. Advanced cameras offer an adjustment option to compensate for this, otherwise a visit to the camera service may be due to readjust the autofocus.

Contrast detection autofocus

How contrast detection autofocus works

The principle | The contrast detection autofocus analyses brightness and colour differences directly on the image sensor. In a sharp image, brightness and colour transitions are more abrupt, i.e. the contrasts within small parts of the image become larger. Muddy, blurred areas become distinguishable points with different brightness and colour.

In and out of focus photos of a monitor display, with histograms

The picture illustrates this principle: I photographed the heading of the German version of this chapter from the screen, once sharp, once blurred. And then, in an image processing program, I inserted the histogram into both, which shows the brightness distribution of the pixels.

The out-of-focus image has a very narrow histogram, meaning that many pixels lie in a fairly narrow brightness range, because light and dark pixels blur into a uniform muddy gray. In the sharp image, the individual pixels of the screen become visible, and the uniform gray becomes a pattern of bright dots with dark spaces in between. Accordingly, the histogram is much wider, the image contains a larger range of brightness. This can be easily evaluated mathematically in the camera electronics to compare the sharpness of two images. With correct focusing, the contrast reaches a maximum.

The focusing procedure | The contrast detection autofocus can therefore only compare which of two images is sharper. Unlike the phase detection autofocus, it cannot tell whether the lens is set too close or too far and how far it has to be moved.

That is why the contrast detection autofocus needs more movement, it can only approach the optimal sharpness:

  • It moves the lens a little in one direction and checks whether the image is getting sharper or blurrier.
  • If the image becomes less sharp: Stop, turn around, move the focus of the lens in the other direction.
  • Continue to adjust the focus distance of the lens as long as the sharpness increases.
  • As soon as the sharpness decreases again: Stop again, turn around, move the focus distance back to where the maximum was.

So several movements are necessary, and even if your subject is perfectly sharp at the beginning, the contrast detection autofocus has to move back and forth a little to confirm.

Focus tracking for moving subjects | When detecting movement, the contrast detection autofocus is at an even greater disadvantage compared to the phase detection autofocus, which can always use one reading to determine how far and in which direction the focus needs to be changed. The contrast detection autofocus already gets into trouble at the beginning because it cannot reliably detect the direction of movement towards or away from the camera.

On the other hand, the contrast detection autofocus can more easily tell from the overall image information whether a subject is moving around within the frame. The phase detection autofocus has a harder time creating some sort of image recognition with its limited number of sensors and tracking to which of its autofocus sensors a subject is moving.

It doesn't work without contrasts | This principle also applies to the contrast detection autofocus, albeit somewhat weakened. It also needs contrasts in order to function, but it doesn't care whether an edge is horizontal or vertical.

Contrast detection autofocus in modern cameras

Speed | As far as speed is concerned, the contrast detection autofocus is at a disadvantage compared to the phase detection autofocus because of the way it works. And with older cameras it was also noticeably slower, you could hear by the noise of the lens and observe on the camera monitor how the autofocus moved back and forth several times.

Over the years, however, contrast detection autofocus has caught up considerably:

  • Reading out the image sensor line by line takes a certain amount of time; even today (2021) in the range of 1200 sec. That was slower a few years ago and a speed limit for contrast detection autofocus.
  • Focus evaluation, like all computers and smartphones with their software, has become faster.
  • The mechanical adjustment of the lens has accelerated with greater manufacturing precision; with faster tiny electric motors and lenses that need smaller mechanical movements to adjust.

However the question of whether phase or contrast autofocus is faster is now becoming almost obsolete. Phase detection autofocus is mature and meets the high demands of professional sports and action photography in high-quality SLR cameras. Pure contrast detection autofocus is disappearing from high-quality cameras – hybrid autofocus is gaining ground, bringing together the advantages of both worlds.

    Accuracy | Because contrast detection autofocus can read the full resolution of the image sensor, it has a slight advantage in achievable accuracy.

    Image coverage | The contrast detection autofocus can evaluate any area over the entire image section for focusing. The camera software allows automatic selection of where the camera focuses as well as differently sized focus points that can be moved across the screen.

    Combination with image recognition | Another advantage that results from reading out all the sensor data for autofocus and the performance of the camera electronics that has grown over the years: The autofocus can recognise faces and automatically focus on them. Recent high-performance cameras even focus specifically on the eyes within a face and recognise the eyes of animals.

      Hybrid autofocus

      The principle | Simply put, hybrid autofocus is a combination of phase detection autofocus and contrast autofocus in one camera, as the name suggests.

      However, a true combination of separate phase detection autofocus as in SLR cameras and contrast detection autofocus only existed in Sony's SLT models as outlined above, which phased out at the end of 2020.

      Meanwhile, manufacturers have managed the trick of integrating tiny sensors for phase detection autofocus directly onto the image sensor. They still use the phase detection autofocus principle described above.

      The advantages | The manufacturers thus do the obvious and combine the advantages of both systems:

      • Phase detection autofocus gives the starting signal in which direction and how far to focus. And it helps to track the sharpness of moving subjects.
      • The contrast detection autofocus helps with image recogition, track a moving subject within the image frame and tickles more precision out of the focusing.

      Comments or questions? Type in & send!

      Our privacy policy applies.