• Please use real names.

    Greetings to all who have registered to OPF and those guests taking a look around. Please use real names. Registrations with fictitious names will not be processed. REAL NAMES ONLY will be processed

    Firstname Lastname

    Register

    We are a courteous and supportive community. No need to hide behind an alia. If you have a genuine need for privacy/secrecy then let me know!
  • Welcome to the new site. Here's a thread about the update where you can post your feedback, ask questions or spot those nasty bugs!

Autofocus in EOS dSLR cameras (a multi-part series)

Doug Kerr

Well-known member
I have recently conducted a multi-faceted "contemplation" of the autofocus system used in Canon EOS dSLR cameras. A recurring thread was to answer certain questions that recur in connection with this system (I will highlight questions as I go).

The project included:
• Extensive testing with various bodies and lenses here.
• Contemplation of hints found in a Canon patent (not actually dealing with the matter of autofocus, but describing an AF process as part of a context for discussing the actual topic of the patent, an improved interface between the lens and the body).
• Parsing of information found in the Canon repair manual for some early EF-series lenses.
• Some comments made by Chuck Westfall during dialog on part of this topic on the ProPhoto Home forum.

I was assisted in my investigation by the stimuli and insights afforded by my colleague, "WilbaAtProPhoto", on the ProPhoto Home forum.

Not every aspect of the topic will be covered in this series. I will in particular not speak here of the matter of selection of AF points or issues of AF point sensitivity.

I will also not speak for now of the matter of "focus search", which refers to the fact that, when AF is called for, if the system is not able to make a satisfying "defocus" determination (the camera is so far out-of-focus that there is no workable image on the AF detector), the lens focusing mechanism is moved until a satisfying determination can be made.

Note that in any case, very little of what I describe here has been unequivocally confirmed by Canon. It is much the result of reverse engineering and forensic engineering.

The reader who knows otherwise is urged to come forth.

************

The big picture

I describe the overall basic AF scheme as "closed-loop overall, with open-loop movements".

Closed loop overall means that, overall, the AF system does what it needs to until proper focus (within a certain tolerance) is indicated by AF detector measurement.

Open loop movements refers to the fact that when the system puts the lens focusing mechanism into motion, it has already determined how much movement from the current position should lead to the attainment of proper focus.

Let's see that in action.

We will of course assume AF mode, in particular one-shot AF.

In this scenario, I will leave out an important aspect, to allow best clarity of the basic scheme. I will introduce it presently.

1. We full press and hold the shutter release.

2. The body makes a numerical defocus determination by observing the deviation from perfect alignment of the image on the two autofocus "subdetectors" of the AF detector of interest (visualize a split-prism focusing aid on the focusing screen). An adjustment is made based on information from the lens (we will discuss that in a later part of this series - remember, this is the "big picture").

3. If the result is "it's perfect" within the established tolerance (which is, incidentally, fed from the lens), then focus confirmation is declared, and the shutter is allowed to fire. This is the consummation of the "closed loop overall" nature of the process.

4. If not, then, via a calculation involving the measured misalignment, certain factors of the AF system geometry, and certain information provided by the lens (more details on this latter) the camera determines how much movement (in "ticks" - a unit specific to the lens), in which direction, should bring the camera into perfect focus for the object of interest.

5. The body tells the lens to move its focusing mechanism that many ticks in that direction. (This is one "open loop movement".)

6. The lens does that.

7. The lens reports when it has done that.

8. We loop to step 2.

Thus we may make zero, one, or several open loop movements, until we have "success" in step 3. Why several? Because at the completion of the first one, the check of defocus shows it not yet within tolerance. Why might that happen? More on that later.

What does it typically look like if two or more open loop movements are needed? If we watch the focus indicator scale, we will see it move to nearly the final position, pause a very tiny time, then move some more, and perhaps pause a very tiny time, and move again, eventually "closing in" on the final point. Then (assuming we are still in full press) the shutter trips.

"WilbaAtProPhoto " calls this "the twitch".

An added wrinkle

This aspect was not mentioned above for simplicity's sake. Its is wholly a conjecture on my part.

When the lens is on the way under its first open-loop movement, part way along (I have no idea how the body decides when) the body evidently takes another defocus measurement and updates its view of where the focus mechanism should end up in terms of ticks from its current position (essentially redoing steps 2-5, "on-the-fly").

Suppose that when the body tries this, it finds that there is not enough luminance of the object to make such an "on the fly" defocus determination (even though there was plenty of luminance for it to do it "leisurely" in the original step 1). Then it has the lens stop its motion, makes a "leisurely" defocus measurement, and then updates steps 3-5, sending the lens on its way to its (possibly changed) destination. It is essentially a "mid-course correction" feature.

Note that if the object is moving, this will give us an update for that (even though we are not in AI servo mode).

What if no defocus determination can be made, even on the "leisurely basis" (perhaps the lights have just gone out)? The process stalls - we cannot take the shot.

************

Well, this may all be quite startling to some. I'll let you digest this.

In the next part of this series, we will examine what data is stored in the lens, what happens if it is not "appropriate", and the matter of "lens calibration".

[To be continued.]

Best regards,

Doug
 
Last edited:

Doug Kerr

Well-known member
Part 2

**********

Calibration of bodies and lenses

In connection with AF accuracy, we often hear of calibrating an EOS body, or calibrating an EF lens. Today, we have added wrinkle of "AF micro-adjust", which essentially allows us to tune up the "calibration" of a lens ourselves. (I won't treat the latter here.)

There are several mysteries that arise in this connection. One of the most thorny is this:

Assume that the body involved is "perfect". Then, considering that the overall process is "closed loop", what could possibly be wrong with a lens so that the final result of the AF process is not within tolerances? After all, the system will make as many open-loop movements as needed until the body determines, with its AF detectors (which we assume are "perfect") that focus is within tolerances.​

The answer will emerge as we look a little further into the principles involved in the process.

THE BEST FOCUS CORRECTION VALUE

Spherical Aberration

In a simple lens with spherical surfaces, the rays coming from one point of the object are not (as we would wish) brought together at a single point of the image.

Rather, the rays from an object point on axis passing through the center of the lens' exit pupil are brought to a focus at one point along the axis. The rays from that same point that pass through the outermost portion of the exit pupil are brought to a focus at another point along the axis (nearer the lens, in our simple example).

Thus, there is no place we can put the focal plane such that the points of the object are imaged as point - for any location of the focal plane, the light from a point on the object will form a circle of confusion (blur circle). The best we can do is to focus such that the narrowest part of this mess falls on the focal plane.

Of course, various steps can be taken in lens design to mitigate spherical aberration (SA), but in many cases, these have undesirable side effects. Thus a compromise among the mitigation of various aberrations, including SA, must be adopted by the lens designer. And we are usually left with enough SA that we have to talk about it here.

Effect on AF

In an AF detector, we ignore all rays except those coming through two small windows at opposite sides of the exit pupil (top vs. bottom, or left vs. right, depending on which direction of line the particularize detector is aimed at working with). These are allowed, respectively, to form images on two "subdetectors". If focus is perfect, these images will be at consistent locations (just like the images on both sides of the split in a split-image focusing aid in the viewfinder).

But, owing to SA, that "perfect focus" is as pertains to the rays passing through the outer regions on the exit pupil. But the focus situation we want is the one that makes the best compromise between where those "marginal" rays are brought to a focus and where the rays through the center of the exit pupil are brought to a focus.

Thus, of we move the lens until the images line up perfectly on the AF subdetectors, we will not have "best focus in the face of SA".

Overcoming that error

To improve on this, the lens reports (for its current focus setting, and zoom setting, if a zoom lens) a best focus correction value (BFCV) that reflects its own SA reality. After the body has determined the "misalignment" between the images on the two AF subdetectors of interest, it then adds this correction value before:

• Deciding if focus is already perfect, so the shutter can fire without any lens movement, and, if not,

• Calculating how much lens movement should bring us to an "best focus" situation.

Suppose that the BFCV fed to the body is not "appropriate" (perhaps gremlins visited the lens and changed its SA behavior).

Now two things happen:

• The reckoning of the needed lens motion might be improper. If that was the only problem, it might lead to a "multi-movement" closure on AF.

• The conclusion when best focus had been attained (so that further movement was not made, and the shutter allowed to fire) would be erroneous.

Thus, even in the face of a "closed loop overall" scheme, we can have focusing error caused by a problem with a specific lens.

LENS FOCUS SENSITIVITY

The situation

When the body has determined the misalignment on the AF detector, and has corrected that for the effect of SA by applying the BFCV, the body can (by a calculation only involving the geometry of the AF system, not dependent on the particular lens) determine how far in front of or behind the focal plane if the image of the object. Suppose it concludes that it is 0.005 mm behind the focal plane.

Suppose then that we tell the lens to move its focusing mechanism forward by 0.005 mm. Will that bring us to best focus?

Not necessarily, for two reasons (at least):

• If the lens does not use "all element" focusing, in which the whole lens moves back and forth (as on a view camera, or with an ED 50mm macro), then a movement of the focusing mechanism by 0.005 mm may not have the same effect as moving the whole lens forward by 0.005 mm. And the distance may vary in different parts of the focusing range.

• Unless we are focused at "a great distance", moving the lens forward by 0.005 mm does not move the image forward by 0.005 mm. The reason is that the object is now closer to the lens by that amount, and so the image moves back from the lens. So we might find that when we move the lens forward by 0.005 mm, the image moves back from the lens by 0.003 mm, thus giving us a net movement of the image forward by 0.002 mm.

But we needed the image moved forward by 0.005 mm!

The solution

The solution to this is that the camera report, for its current focus setting (and zoom situation, if applicable) a "sensitivity factor". (It actually does this in two pieces, a base value for the lens and an increment applicable to the current focus setting).

The body combines those and then divides the needed movement of the image by that, arriving at a necessary movement of the lens, It then applies another coefficient provided by the lens, telling the scaling of its unit of movement (I call it the "tick"). The result is the number of ticks the lens will be asked to move in the "open-loop movement".

Effect of error in the values

Suppose that the sensitivity factor reported by the lens is not "appropriate" (more gremlin visits, perhaps).

Then, the reckoning of the amount of needed movement will not be correct. When the movement is done, the body again checks the focus state with the AF detector (applying the BFCV, to outsmart the effect of SA), and concludes that we are not there yet. So the process is iterated.

In this case, the final result is not residual focus error, but the need to make more than one open-loop movement slows down the completion of AF, and is not desirable.

*********

That's what I think are the most prominent ingredients of the situation. There are doubtless additional, more subtle implications.

Again, my story is derived solely by reverse engineering and forensic examination of documents and folklore.

Readers who know otherwise are urged to come forward.

Best regards,

Doug
 

Doug Kerr

Well-known member
Further testing and contemplation have suggested a revised description of the Canon EOS AF process.

1. We full press and hold the shutter release.

2. The body makes a quantitative defocus determination by observing the deviation from perfect alignment of the image on the two autofocus "subdetectors" of the AF detector of interest (visualize a split-prism focusing aid on the focusing screen). An adjustment is made based on a correction value fed from the lens (this compensates for a predictable error arising from spherical aberration).

3. If the result is "it's perfect" within the established tolerance (which is fed from the lens), then focus confirmation is declared, and the shutter is allowed to fire. This is the consummation of the "closed loop overall" nature of the process. Every AF job ends here.

4. If not, then, via a calculation involving the measured misalignment, certain factors of the AF system geometry, and certain "sensitivity" and "scaling" information provided by the lens, the camera determines how much movement (in "ticks" - a unit specific to the lens), in which direction, should bring the camera into perfect focus for the object of interest.

5. If this is the first time through this step, and for certain lenses, and in certain situations (the details of which are not yet known to me), that value is discounted to something in the range of 60-75% its calculated value.

6. The body tells the lens to move its focusing mechanism that many ticks in that direction. (This is one "open loop movement".)

7. The lens does that and reports that it is done.

8. Loop to step 2.

Best regards,

Doug
 

Doug Kerr

Well-known member
Even further testing has led me to a further revision of that description of what seems to be the overall One-shot AF algorithm in EOS cameras. The change is in step 5.

*********
1. We full press and hold the shutter release.

2. The body makes a quantitative defocus determination by observing the deviation from perfect alignment of the image on the two autofocus "subdetectors" of the AF detector of interest (visualize a split-prism focusing aid on the focusing screen). An adjustment is made based on a correction value fed from the lens (this compensates for a predictable error arising from spherical aberration).

3. If the result is "it's perfect" within the established tolerance (which is fed from the lens), then focus confirmation is declared, and the shutter is allowed to fire. Every successful One-shot AF job ends here.

4. If not, then, via a calculation involving the measured misalignment, certain factors of the AF system geometry, and certain "sensitivity" and "scaling" information provided by the lens, the camera determines how much movement (in "ticks" - a unit specific to the lens), in which direction, should bring the camera into perfect focus for the object of interest.

5. For certain lenses, and in certain situations (the details of which are not yet known to me), that value is discounted to something in the range of 60-75% its calculated value.

6. The body tells the lens to move its focusing mechanism that many ticks in that direction.

7. The lens does that and reports that it is done.

8. Loop to step 2.

*********

Let me make one comment on the "observable" behavior of the focusing mechanism. Consider a lens and surrounding conditions (whatever those are) that bring about the recalculation in step 5. We might think that if that occurs, then in step 6, the lens movement will stop well short of the final correct focus point, and then (after another focus determination and movement calculation) move on. Indeed we do see what seems to be just that in some cases, but only if the target luminance is "modest".

As the target luminance is increased, we find that the observed duration of the pause becomes shorter and shorten, and eventually, no pause can be seen by ordinary observation.

This makes sense. The lower the target luminance, the longer it takes for images for "form" on the AF subsensors (in the same way that, in an actual shot, for a low illuminance on the main sensor, the exposure time required for a good image increases). The lens stays still while this plays out.

My guess is that, when (in the face of increasing target luminance) we no longer see a pause, the lens has in fact been commanded to go to an intermediate location, stops, and reports that to the body. The body takes a focus measurement, able to do that very quickly owing to the greater target luminance. It makes the new calculation (per step 4 and perhaps 5), gives a fresh movement command to the lens, and the lens moves on.

If this all takes place in, say, 5 ms, we might in fact not perceive it as a "pause" in lens movement at all.

*********

Of course, all this is based on my own extrapolation of extensive tests and observation, but we do not have any definitive confirmation of it. Chuck Westfall has indicated that Canon does not choose to go beyond a certain point in disclosing the details, and Julian Assange has not yet weighed in.

Of course, some of you may have information that reveals or suggests different details. I urge you to come forward with any such.

Best regards,

Doug
 
Top