22
Jul
09

Auto focus is confusing?

I while back, I looked through the archives at Cambrigde In Colour, and found this article about auto focus technologies. The author tried to describe how the autofocus of dSLR’s are working, when in fact he was describing the contrast based autofocus most commonly used in compact cameras. Later I found Tim Jacksons D70 site, where he also describes a focus system that I don’t really think exists in any camera on the market. After looking around on the net, it occurred to me that there are many attempts to explain autofocus out there that are just plain wrong. It seems like the phase dection autofocus system used by all SLR cameras, both digital and film, is a bit hard to grasp, so most authors explains the conseptually more easy contrast based autofocus instead. Or maybe they just fail to see that there is a difference.

Contrast based auto focus

To start with contrast based auto focus. This type of system is most commonly used in compact cameras, and on some dSLR’s when the Live View function is used. It uses the actual imaging sensor to determine focus, and here is how it works:

  1. It shoots a series of images at different focus settings.
  2. For each of these images, it will determine how  much contrast there is in the designated focus areas.
  3. It selects the image with the most contrast, and reset the focus to the value it used to capture this image.

This process is relatively slow since the camera must take a large number of shots and process them before finding the focus. On many cameras you can observe this if you look at the lens while trying to focus. It will cycle focus from one endpoint to the other before it snaps back to somewhere in between which hopefully is the right focus setting.

A major drawback with this kind of focus is that the camera has no way of predicting if the focus is in front of, or back of the current setting. It must just try in one direction and hope that it is right, and if not, it must go the other way.

Phase detection auto focus

This type of auto focus works kind of like the good old split prism in the days of manual focus. The focus system will take a part of the light coming from one side of lens and project it on one sensor, and a part of the light coming from the opposite side of the lens and project it on another sensor. These sensors are dedicated AF sensors, and are usually formed as narrow strips. When the image is in focus, the two images are perfectly aligned, but they will get more and more misaligned as the system gets more and more out of focus. Just like the split prism, all the AF system has to do is to rotate the focus until the two images are aligned.

A major benefit with this type of AF is that it can predict which way the focus shall be turned. Not only that, but it can even predict how far it shall be turned. This is accomplished by detecting to which side the misalignment is, and how much the images are off.

Here is a short drill down how it works:

  1. The AF sensor detects the direction and amount of misalignment.
  2. Based on the information about the lens, if predicts how far the focus must be turned.
  3. The focus is then adjusted accordingly (focus is not measured when this happens since the focus changes too fast).
  4. When the focus motor stops, a new measurement is performed. If the focus is not perfect the drill (1 through 3) is performed over again, but now the adjustments are much smaller, and therefor more precise.
  5. This goes on until the focus is good, or the system times out because it is unable to find focus.

The big misconception is that this system optimizes contrast, when in fact it correlates two one-dimensional images. When the contrast based system relies on a sharp edge to focus, this system only need some sort of recognizable pattern. In theory, it should be able to focus on a smooth gradient that goes along the focus sensor.

Here is an illustration by Canon (go to the bottom of the page).

And here is the Wikipedia article.

So, this is an overview of my understanding of these systems. If anyone more knowledgeable than me finds this to be wrong, please write me a comment.


7 Responses to “Auto focus is confusing?”


  1. July 22, 2009 at 19:01

    Kjell, I think most phase detect AF systems are open-loop, thus they exclude steps 4 & 5. There is also the point about tolerance: how close to matching is in focus.

    From observation I think most contrast detect systems are closed loop, and as you point out that is needed anyway as they have to make multiple guesses to determine direction of travel anyway.

  2. 2 Kjell
    July 22, 2009 at 21:38

    Martin,
    I almost, but not fully agree there,
    All phase detection system I have tried seems to do 1-3 fine adjustment rounds after the initial focus, at least when the conditions are difficult. I agree that they are technically open loop in the sense that they do not measure the result continuously. This is of course done to increase speed, but at the expense of precision.

    As for the contrast detection systems, I guess they comes in all variants depending on how good (expensive) the camera is. The contrast focus in Live View on my new K-7 is obviously a closed loop system, while my cell phone camera, and various compact cameras I have tried, seems to just try out the entire range before it decides on the best.

  3. July 22, 2009 at 21:59

    Whatever they actually do, they all seem a long way from good. With current computing speed and modern adaptive control algorithms, it should be quite easy to program a fast and accurate AF, even with limitations in motor speeds.
    Following the EOS 1DIII problems, I wrote a while back about the problems with AF and fast cameras. And yet this should be easy to make better.

  4. 4 Kjell
    July 22, 2009 at 22:09

    Yep, that I fully agree with. Since they already have more computing power inside the camera than they could ever need, I guess they are saving on the sensor throughput and accuracy.

    Or maybe they are just not allowed by management to spend the time on the programming.

  5. July 23, 2009 at 10:38

    Kjell, nice article. Good to see you posting again!

  6. 6 Kjell
    July 25, 2009 at 9:39

    Thanks Eric, Although I’ve been slow at commenting, I’m still reading and enjoying your blog every day (and yours Martin).


Comments are currently closed.

Visit my home page

View the images from my blog

You'll find the gallery here (starting august 2008)

Print Swapping

a

free hit counters