# Finding the optimal Micro Adjustment



## epsiloneri (Dec 22, 2010)

Is focus micro adjustment a must-have feature? The absence of the feature in the recent 60D has sparked some debate. Triggered by a recent problematic lens, I've been interested in measuring the focus performance of my lenses and the possibility to micro adjust (MA) focus offsets of the auto focus (AF). The usefulness of the MA feature is dependent on the ability to accurately (and consistently) establish any potential focus offset, otherwise there is not much point in tweaking the MA. E.g., if the variance of the AF is greater than the MA, then there is very little benefit with MA.

I've experimented a bit with various methods, and the trouble I have with most of them is that they require visual inspection of images very similar to each other, which I found hard to do. Instead, I opted for the quantitative approach of measuring the contrast in an image as a proxy for its sharpness, with the assumption that more out-of-focus images will be less contrasty. That is the way "live view AF" works, which I've found to give very accurate and consistent results in good light (albeit a bit slow).

To obtain consistent results, I used a focus target properly aligned with the camera. I think any contrasty image in principle can be used as a focus target, I used one I found from Keith Cooper's MA page (below is a crop of the full image)






I found it good because it provides contrast structures on many angular scales. I displayed that image on my computer TFT screen and used the screen as a focus target. To align the the camera with the screen I taped a CD flat onto the screen, to use it as a mirror, and then checked that the center of the camera lens was seen centered in the viewfinder of the camera. This ensures that the focus target is orthogonal to the optical axis, which is again orthogonal to the image plane; that is, the focus target and the image plane are parallel. During the test shots I naturally removed the CD.

The camera was placed at a distance 25 times the focal length (i.e. at 2.5 meter for a 100mm focal length lens). I also once tried at 40 times the focal length and got consistent results, albeit with more scatter.

I took a reference image using live view contrast AF, and then obtained 4 images per MA setting using phase AF, and varied MA from -20 to +20 in steps of 5, i.e. 1+36 images in total per lens (camera, and focal length combination). I de-focused twice to infinity and twice to the near limit per MA setting, before AF.

To quantify the contrast of an image, I looked at the subimage of the focus target only (it doesn't cover the whole field) and computed the standard deviation of the intensity distribution (that is, of the grayscale image; I used MATLAB to do this, you can probably do it less conveniently in photoshop. There is also the free MATLAB clone octave if you're GNU inclined). The same procedure was repeated for both a 7D and a 5D2.

An attached figure shows an example of contrast measurements as a function of MA for a Canon EF 100/2.8 USM macro lens mounted on a 5D2. The error bars are derived from the 4 measurements per MA. A parabola is fit to the 5 best points, and in this case the optimal MA was found to be 8.9 +/- 1.2. I repeated this measurement for a number of lenses, here are the results:

Lens 7D 5D2
================================================
Canon EF 14/2.8L II -4.3 +/- 1.0 2.9 +/- 1.0
Canon EF 15/2.8 fisheye 10.3 +/- 0.7 19 +/- 3
Canon EF 24/1.4L II -11.8 +/- 0.6 -6.7 +/- 0.8
Sigma EX 50/1.4 HSM 3.2 +/- 0.5 13.8 +/- 0.7
Canon EF 85/1.8 USM -19.2 +/- 2.8 -7.2 +/- 1.2 
Canon EF 100/2.0 USM -14.3 +/- 0.5 0.4 +/- 0.8
Canon EF 100/2.8 USM macro -0.8 +/- 0.5 8.9 +/- 1.2

Canon EF-S 10-22/3.5-4.5 USM IS @ 10mm -11.0 +/- 0.4
Canon EF-S 10-22/3.5-4.5 USM IS @ 22mm -10.5 +/- 0.5

Canon EF-S 17-55/2.8 USM IS @ 17mm 2.9 +/- 0.5
Canon EF-S 17-55/2.8 USM IS @ 55mm -11.9 +/- 0.5

Canon EF 24-105/4.0L USM IS @ 24mm -1.0 +/- 0.4 6.1 +/- 0.7
Canon EF 24-105/4.0L USM IS @ 105mm -7.4 +/- 0.5 0.5 +/- 0.9

Canon EF 70-200/2.8L USM IS @ 70mm 1.2 +/- 0.5 -2.7 +/- 1.2
Canon EF 70-200/2.8L USM IS @ 200mm -2.6 +/- 1.8 8.2 +/- 1.5
================================================

There appear to be a fair range of optimal MA, more than I would have guessed. I will have to verify that these results hold up in the field, but that will take a while.

One question I was interested in is whether there is a constant MA offset between the 7D and 5D2. Looking at the primes only, I plot the 7D MAs versus the 5D2 MAs in the figure attached. There appear to be a clear linear correlation; I find the best fit to be that MA_5D2 = MA_7D + 9.7, with an error in the mean of 1.3 and a scatter of 3.2. The 7D seems more well centered, despite the 5D2 having been recently sent to CPS for recalibration.

The zoom lenses show a more complicated behaviour, with MA changing with focal length.

In summary, I think measuring the contrast in an image as a function of micro adjustment, with the aim to find an optimal adjustment, is an attractive alternative to visual inspection. I realise this method is not for everyone, as it involves more image analysis and data manipulation than most photographers are probably comfortable with (or used to).


----------



## Edwin Herdman (Dec 25, 2010)

That's interesting. I'd expect a parabola to be the best fit for finding the sharpest setting with a lens, but what does the complex curve for a zoom lens look like (expecting it to be different for each lens)?


----------



## epsiloneri (Dec 26, 2010)

There are several parameters that can affect the focus, and specifically the autofocus, of a lens. A few I can think of:

* Focal length of lens (for zoom lenses)
* Distance to focus target
* Aperture of lens
* Shape of focus target
* Colours (spectrum) of focus target
* Relative (3D) velocity to focus target
* Temperature of lens
* Temperature, humidity and pressure of air

As testing for MA is a bit time consuming, I have only really checked the first two parameters, and not very thoroughly. For one lens (and two camera bodies), I found that changing the distance to the target from 25x to 40x the focal length did not affect how the AF behaved as a function of MA. The set focal length on zoom lenses, however, did change the optimal MA. The contrast as a function of MA does not qualitatively look different from the prime lenses, but it changes with set focal length. I give an example in the attached figure, which shows the contrast as a function of MA for the EF 24-105/4L lens on 7D, set at 24mm (green) and at 105mm (blue).


----------

