PDA

View Full Version : Canon EOS focusing strategy


Doug Kerr
June 30th, 2010, 05:38 PM
The most widely-accepted story as to the overall operation of the autofocus system in Canon EOS digital cameras has, for some while, gone like this:

Story A

Assume that the center AF point is manually selected (so we need not concern ourselves with AF point selection), and assume that One Shot focus is in effect. Ignore the fact that at the center point there may actually be two AF detectors (with opposite orientation - the so-called "cross mode" detector).

When we half- or full press:

1. The body attempts to recognize a similar pattern on the two halves of the AF detector. Assume that it is able to do this.

2. The relative positions of the pattern on the two detector halves is determined, and compared with the relative positions they would have for "perfect" focus (equivalent to the alignment of the visual pattern on the two halves of a "split-image" focusing aid in the viewfinder). We will call the difference from the perfect situation the "focus error".

3. The body feeds the focus error to the lens.

4. The lens contains in it tables that define a mathematical function which relates distance to the focus target, focus cam position, and focus error. The lens uses this function, based on the reported focus error and the current position of the focusing cam (read from a digital position encoder), to calculate the focusing cam position that should produce perfect focus on the focus target that was observed by the AF detector.

5. The lens then instructs the focusing cam positioning system to move the focusing cam to that position. [Exactly how it does that is not of concern to this part of the story.]

6. The lens reports to the body that it is done.

7. The body declares focus lock to have been achieved. If we are in full press, the body fires.

Period.

But there are those who feel that this alternate story actually describes the system (I will restate all assumptions and all common clauses for completeness, but the changed portions will be in blue).

Story B

Assume that the center AF point is manually selected (so we need not concern ourselves with AF point selection, and assume that One Shot focus is in effect. Ignore the fact that at that point there may actually be two AF detectors (with opposite orientation - the so-called "cross mode" detector).

When we half- or full press:

1. The body attempts to recognize a similar pattern on the two halves of the AF detector (if it is operating in "cross" mode, it does this on each of the two detectors at the point. Assume that it does find recognizable patterns.

2. The relative positions of the pattern on the two detector halves is determined, and compared with the relative positions they would have for "perfect" focus (equivalent to the alignment of the visual pattern on the two halves of a "split-image" focusing aid in the viewfinder). We will call the difference from the perfect situation the "focus error".

3. The body feeds the focus error to the lens.

4. The lens contains in it tables that define a mathematical function that relates distance to the focus target, focus cam position, and focus error. The lens uses this function, based on the reported focus error and the current position of the focusing cam (read from a digital position encoder), to calculate the focusing cam position that should produce perfect focus on the focus target that was observed by the AF detector.

5. The lens then instructs the focusing cam positioning system to move the focusing cam to that position. [Exactly how it does that is not of concern to this part of the story.]

6. The lens reports to the body that it is done.

7. The body now determines the current indicated focus error (in the same way described in step 2).

7.1. If that error is not over some predetermined tolerance, the body declares focus lock to have been achieved. If we are in full press, the body fires.

7.2 If that error is is over the predetermined tolerance, the error is fed to the lens, and the process loops from step 4.

I recently discussed this matter in a thread on the Pro Photo Home forum, inviting Chuck Westfall, Canon USA's chief technical information officer, to weigh in. The bottom line of my inquiry was, essentially, "Which is so, Story A or Story B."

Chuck give many interesting insights into various aspects of the matter, but did not directly answer the question. I persisted in pressing the question, and Chuck then said this is not a matter Canon has chosen to disclose. Fair enough.

If you would like to review the bidding, the thread starts here:

http://www.prophotohome.com/forum/canon-1-series-digital-slr-eos-5d/91885-canon-eos-af-scheme-chuck.html

However (as discussed in part at the end of that thread), some tests recently done here seem to suggest story B. There were actually two tests. A Canon EOS 40D body was used for most of the tests.

In each case, the body was set to One Shot focus, Focus Search was turned off, and the center AF point was preselected. The focus was preset to a point, as far as possible from "correct focus" but still one at which the AF system could still make an image match to determine a focus error value (that is, not an initial situation that would ordinarily cause the body to use Focus Search to get started).

Test 1

Procedure

I would smartly full press and, as soon as the lens focus cam began to move, placed my hand in front of the lens (continuing to hold full press).

Result

The focusing cam moved to what turns out to be very nearly the point of perfect focus and stopped. The camera did not fire. The focus confirmation light blinked green ("focus not confirmed").

Holding full press, I then removed my hand. The focus cam moved slightly and then the camera fired.

Interpretation

To me, this strongly suggests that, after the completion of the "calculated" movement of the focusing cam by the lens, the body looks at the AF detector to see if focus is in fact now within the tolerance. In this case, it could not (at first) make a determination at all (the path to the AF detector being blocked), so it just sat tight (probably repeatedly "examining" the AF detector).

When I removed my hand, the body did make a determination, it was that focus was not in fact perfect, and fed the residual error to the lens which went through the process (from step 4 of Story B) again.

Test 2

Camera as aimed at a distant object. The focus was then set to a much closer distance, but such that Focus Search was not needed to focus onto the distant target.

I would smartly full press and, as soon as the lens focus cam began to move, quickly slewed the camera to point to a much closer area (continuing to hold full press).

Result

The focus cam moved to essentially the position corresponding to the distant target, then moved back to a closer position (consistent withe the closer "new target area") and then the camera fired.

Interpretation

This strongly suggests to me that the scenario was:

1. At full press, the body made a determination of focus error (with respect to the distant target then in aim) and fed that error value to the lens.

2. The lens calculated the new focus cam position that should put into focus the target on which the focus error determination was made.

3. The lens puts the focus cam positioning mechanism into action to move the focusing cam to that position.

4. Meanwhile, I have moved the aim of the camera onto a nearer scene.

5. When the positioning of the focusing cam is complete, the lens reports that to the body.

6. The body examines the AF detector to see if in fact focus within the tolerance has been achieved. It certainly has not (I screwed that up greatly).

7. The onserved focus error is fed to the lens (for a new "round"), which calculates the focus cam position that should produce proper focus on the (new) target.

8. The lens moves the focus cam to that position.

9. When that is done, it reports such to the body.

10. The body examines the AF detector to see if in fact focus within the tolerance has been achieved.

10.1 If it is, the camera fires.

10.2 If it isn't, there might be a further cycle (making a small adjustment). [ I couldn't tell by watching - there was too much going on!]

With all this in hand, it is hard for me not to believe that - at least with my EOS 40D - Story B is in effect.

Or, as Will Thompson reminds me, there is something going on that I never even imagined.

Ah, the mind of Canon.

Now, if Story B is in fact the story, it raises this curiosity. We have all learned that systematic misfocus by a lens results from its internal computation function not precisely matching its mechanical-optical behavior. We have the lens calibrated to correct that.

But, under Story B, while an incorrect internal function would make the lens not (in the first "round") attain the perfect focus position, this would be followed by a second round, and if necessary further rounds, which we presume would be "convergent" on the ideal focus.

Thus the result of an inappropriate set of table values would not be recurrent focus error, but perhaps only slower completion of focus.

It is interesting that every lens I have (including two Sigmas that I suspect, from other indications, have inaccurate "calibration"), produce focus that seems well within tolerances. But one of the Sigmas takes quite a while to do it in some cases seeming to take up to five "rounds", with diminishing movement in each, before the camera fires.

I have a suspicion than Canon has changed the nature of its AF strategy since the "common wisdom" regarding Story A was "received". I may philosophize on that later.

I do recall that with my EOS 300D, with some of my lenses, if I would do half press (say with the camera on a tripod aimed at a focus target), wait for AF lock to be declared, then release, then half press gain, the focus cam would move. In fact, I used to suggest this as a test for lens miscalibration. (This was of course poo-poo'ed by various gurus.)

With my 40D, I cannot make this happen at all, one exception being a tiny follow-on movement - sometimes - with the EF 50mm f/1.4. But it has a play-ridden focus cam positioning system, which might lead to anomalous behavior.

Well, as the Cherokee say, that's all I have to say now.

Best regards,

Doug

Doug Kerr
July 1st, 2010, 09:46 AM
By the way, there was some interesting fallout from the series of tests I reported in the post above.

I spent a lot of time observing the lenses' focusing ring and/or focusing scale movement through a magnifier as the system executed its autofocus performance.

In the case of my Sigma 18-200 f/3.5-6.3 OS (my "walkaround" lens on my EOS 40D), i noticed that the focusing ring approached its "final" position (from a start position quite a way distant), there were repeated starts and stops, the overall pattern being an initial long movement to almost the destination, then a shorter one, then a shorter one yet, and so forth - it seeming that there were at least five movements.

My first thought was that this represented staged motion of the lens' focusing cam positioning servo system, with the angular velocity decreasing in discrete steps as the intended final position was approached. But it seemed a little strange that it would be done in so many "stages".

But, as I came to realize that we were probably working under "Story B" ("iterative open-loop AF"), I came to realize that what I saw on the Sigma was probably an initial move to a calculated position that was incorrect (owing to imperfection in the lens' function table), followed by a second pass (with an again imperfect result, closer this time), followed by a third pass (with an again imperfect result, but closer yet), and so forth, until the result was within tolerance (or maybe the body says, "I am only going to give you five tries to get within tolerance - after that, we'll just go with what we have").

Now, if the tables in the lens were "that far off", wouldn't I get very poor AF accuracy? No, because (under Story B) the process is iterated, evidently converging in this case.

Indeed, a check of AF accuracy (using a spiffy test rig - LensAlign Pro - from Michael Tapes of RawWorkflow) suggests that the AF accuracy is quite good. As is to be expected given my current understanding of what is going on here.

But there is still a penalty. It is (at best) that the time to complete AF is significantly longer than it would be if the first pass took us into tolerance.

The result is that our project to perhaps replace this lens - which had stalled after I had "interviewed" two candidates (the Sigma 18-250 OS and the Tamron 18-270 VC) - is now back on. The next candidate: the Canon EF-S 18-200 mm f/3.5-5.6 IS. It is on the way from the B&H lending library by free barge.

I'll fill you in on the results. As in many cases, as we go through this our aspirations are adjusted by reality. Our initial hope was to get a lens with a greater "reach" (that is, greater maximum focal length without a decline in focal plane resolution), and perhaps even some improvement in lateral CA.

Clearly that is not to be had. The lens we seek would cost $3500.00 and would weigh four pounds - but there isn't such a thing.

So we are now concentrating on improved AF and (and perhaps IS) performance while retaining a good balance among the other performance attributes.

Perhaps the homie will deliver.

Best regards,

Doug

Doug Kerr
July 2nd, 2010, 12:57 AM
I describe the "Story B" autofocus strategy as iterative open-loop.

It is open-loop in the sense that, after the focus error is determined by phase comparison in the AF detector, and if it is not already less than some established tolerance, the lens calculates the position of the focusing cam that should produce perfect focus, and the focusing cam is moved to that position (the state of focus not being observed during that movement - thus the "open-loop" description).

It is iterative in that, after the first round just described is completed, the focus error is determined again (from the AF detector) and, if it is not now less than the established tolerance, the lens again calculates a new position of the focusing cam, the focusing cam is moved to that position, and so forth.

Because of this iterative process, the larger scale operation is closed loop (that is, it runs until the desired result is observed).

Note that "open loop" here does not describe the subordinate process of moving the focusing cam to the calculated position. That might be done with a motor running freely under feedback from a position encoder (closed-loop) or with a stepping motor by making the calculated number of steps (open-loop).
************
Note that we do not have confirmation that "Story B" is in fact what we experience in contemporary Canon EOS digital SLRs. There is considerable evidence that it is - or something like it - but there are also various paradoxes (such as why do we need lens calibration, or AF microadjustment, to dispose of systematic lens-specific focusing error).

************
However, the iterative open-loop phase detection focusing scheme does appear quite clearly in a 2003 Canon patent (U.S. 6,603,929), covering an automatic focus system for digital SLR cameras. Focusing is achieved in two stages.

The system first uses phase detection focusing (in the iterative open-loop mode, exactly as described above) to bring focus to approximately the ideal state. (We might think of the "tolerance" mentioned above as being fairly liberal in this case, thus the "approximately".)

Then the system uses contrast detection focusing to refine the focus. Essentially, the focusing cam is moved in discrete steps, and the position providing the highest level of high-frequency components in the image (the actual indicator of contrast used) is adopted. How do we know it is the maximum? We go just beyond the peak, and then back up one increment.

The object it to get the precision of contrast-detection focusing while exploiting the speed of open-loop phase detection focusing.

The patent describes three variations of the system.

A. A stepping motor is used to position the focusing cam. In the phase-detection stage, the motor runs at a relatively high step rate under feedback from a position encoder. In the contrast detection stage, the motor is advanced one step at a time.

B. A stepping motor is used. In the phase-detection stage, the motor running at a relatively high step rate on an open-loop basis (counting steps). In the contrast detection stage, the stepping motor is advanced one step at a time (with a half-size step).

C. A USM-style motor is used. In the phase-detection stage, the focusing cam is positioned by the motor running at relatively high speed under feedback from a position encoder. In the contrast detection stage, the motor is run at a lower speed in "bursts" of one notch of the position decoder.

Very clever.

Thanks to our colleague R. D. Kirk, who called attention to this patent in some of his writings on the Canon autofocus system a couple of years ago.

Best regards,

Doug

Nill Toulme
July 2nd, 2010, 09:02 AM
Interesting stuff Doug (as usual) thanks. Barely on-topic... as you're looking for a new EFs mount walkaround lens, give the Canon 15-85 IS a tumble. I think you might like it. (I sold my Sigma 18-200 OS, which I had liked reasonably well.)

Nill