Sunday, October 14, 2012

dSLR Autofocus Fine-Tune with Moiré Interference Pattern Technique

Autofocus calibration is a useful feature on the D7000 and other Nikon and Canon dSLR's equipped with it, but it can also be one of the most tedious things that you can do with a modern camera. If you've tried it and don't think so, then chances are that you're probably not doing it right... or at least not as rigorously as you should be. I was talking with a a guy about the 50 times focal length test distance that is spec for autofocus calibration, and it was amusing watching him do the math for how much setup distance would be required for a 300mm f/4.

Because I don't have the space for a dedicated setup... and because my eyes are going... and also because I have perpetual coffee hands (this is Vancouver, after all), I've switched to the moiré interference method of autofocus fine-tuning. I've grown to prefer it to over other methods because the setup isn't as fussy, and it's very easy to gauge the degree of lens calibration.


When I first got my Nikon D7000, I was elated that I had control over the calibration of my lenses, instead of having to send my equipment to the nearest service depot. However, with the target/ruler method, I found my first few attempts at calibrating my lenses to be frustrating because of the setup requirements and the discovery that judging focus over and over again is not as easy as it sounds. You have to align your target and your camera. You have to illuminate your target. You have to set up at 50 times the focal length that you are testing in order to match the factory calibration, which requires a necessary amount of space with your longer lenses. And worst of all, examining the test pictures afterwards redefines "chimping" in a whole new way.

The moiré interference method solves two of these problems and makes one of them easier to deal with:
  • You still have to setup properly, but the moiré method is more forgiving. If you use the target/ruler method, your camera needs to be level with the target and aimed dead-on, otherwise, any deviance in pitch will exaggerate front or backfocus.
  • You don't have to setup lighting. Since you are aiming at a computer monitor (this technique won't work with a printed target), your calibration target is already illuminated. This means that you can even do this in the evening after work when the house is dim. Better yet, it's consistent illumination, so you are always testing under the same conditions.
  • It is far easier to judge if you are at peak focus or not compared to targets/rulers. With  the moiré method, you judge calibration by looking at your camera's LCD screen, which is 3 inches in diagonal or more and easy to see. With the ruler/target method, you have to judge focus by downloading test shots and viewing them at 100% to get any sense of how far out you are.
Having said that, I can think of only one practical downside to the moiré method, and that is that you can't quantify how out of calibration your lens is. There is no ruler telling you how many millimeters front or back you are, but this is a small nit.

This technique was first described by Bart van der Wolf. You can read the original thread here. For an in-depth look at the the technique, I recommend these two blogs. You can get the moiré pattern download from either of them:
Alek Komarnitsk's blog:

Northern Images blog:

First, setup the proper distance,which is at least 50 times focal length. If it is a zoom lens, remember to calibrate the lens at the focal length that you use the most often for that lens. Focus your camera with the phase-detection (mirror down) method. For consistency's sake, I prefer to set the lens to the shortest focal distance before aiming at the target; this way, every test is done with the lens focusing first from a very near position up to the point of focus. The reason for this is that every mechanical system has tolerances; if you test your focus a number of times, each time it will focus just a little bit differently. By standardizing the procedure, you are reducing this variability. Hint: you can easily align your test target to 90 degrees perpendicular with with a bubble-leveler. An advantage with this method over rulers/targets is that laptop monitor is easy to adjust and stays in place.

Establish PD auto focus first
Once you've focused your lens with the mirror down, turn off autofocus, leaving the lens at the position that it focused on, and then turn on Live View. The LCD should be displaying the focus as the phase detection system perceives it.

Live View of target, not zoomed in.

Next, keeping the camera on Live View mode, zoom, in on the active display. What you are looking for is the production of the maximum amount of moiré on your camera's rear LCD screen. In the example below, I left the lens extremely out of focus, simulating a badly out of alignment lens. The more out of focus  the setup is, the more the black and white lines of the target merge into grey. You'll have to play around with the manual focus control to figure out if the lens is front or back focusing, but from here, it is a matter of diving into the camera's fine-tune setup, readjusting the calibration, and repeating the test again.

Zoom in with Live View. Example of badly out of calibration lens.
This sample below is of a calibration that is almost, but not quite, perfect. Note that we have distinct black and white lines, indicating that focus is close to maximum. By definition, perfect focus would mean that the peak differentiation between black and white has been achieved, which is how the contrast-detection autofocus works with Live View. However, we are not done yet; note the hint of additional fringing patterns. (You have to click on these images to see the difference. There is the additional factor of the resolution of your monitor, so the amount of interference that you perceive depends on the enlargement factor you are viewing the images at as well)

Lens almost in calibration.
Below is an example of a lens calibration that is in focus, or very darn near close to it. Note the production of extra moiré artifacts on the LCD screen. This is what makes this method of calibration useful: rather than trying to judge degrees of contrast (shades of grey), you have something closer to a binary condition... either yes or no. The amount of focus travel that will produce the fringing patterns on the LCD is very small, and you can easily judge by the quantity of moiré produced, not the degree. In other words, rather than trying to rely on your eye for contrast discrimination, you are instead engaging your brain's discrimination for shape differentiation, which is more reliable at these small differences.

Lens calibrated. Maximum amount of fringing produced.


Recall that moiré is really just false information created when the spatial frequency of the visual data that is being sampled exceeds the input frequency of the device doing the measuring. This applies all the way down the imaging pipeline: your real world subjects generally have more detail than what the camera sensor can sample... but in turn, your camera sensor captures more information than what the rear LCD can display. When the lens is very out of focus, no moiré is generated because the spatial frequency of the information does not exceed the capacity of the LCD screen. That is, if all the camera sees is an amorphous grey blob, then the LCD has no problem displaying it. However, when the lens is in focus, the difference in spatial frequency capacity between capture and display is at a peak; therefore, you will see the maximum amount of false information being produced (moiré) on the lcd display when the lens is in focus.


  1. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it. Dslr camera price in pakistan