Precision Measurement of Focus Error

Started Aug 18, 2014 | Discussions thread
Shop cameras & lenses ▾
Flat view
Marianne Oelund Veteran Member • Posts: 6,341
Precision Measurement of Focus Error

Products and techniques abound for measuring image resolution, sharpness and/or contrast, and this has become the standard approach for assessing focus errors for AF systems.

I must admit that I've never cared much for this approach, however.  The problem is that it loses sensitivity around the in-focus point.  Contrast or "sharpness" curves are parabolic, and where they reach their peak values, they are flat and the precise peak location has quite a bit of uncertainty.  Add to that, a contrast measurement can't tell you whether an image is front- or back-focused.

If we want to study AF precision, a more direct and accurate method of determining the exact focus position of the lens is needed.  It also helps if it's very fast, capable of batch-reading a large set of image files and producing an error value for each one in a short amount of time.

Here I would like to present a method which is capable of high precision, and which yields an ideal metric that varies linearly with lens focus position.  Coupled with image-analysis tools that I have made public, it will give focus error values very rapidly, even for a large set of images.  I have been using it this weekend, to compare a few AF targets - more about that later.

The technique is to place a bright pinpoint source of light in the background, just to the side of the AF target being used or evaluated.  The surroundings of the pinpoint source should be as dark as possible and the diameter of the pinpoint source should be a small fraction of 1mm.  The exact lens focus position (in terms of absolute distance from the pinpoint light source) will then be indicated directly by the diameter of the COC (circle of confusion) of the pinpoint source in the taken image.

The first step is to carefully focus the lens on the target being used, then take an exposure that is long enough to record the COC of the pinpoint source very brightly; this is the reference image which gives the diameter of the COC corresponding to exact focus.  This process can then be repeated a number of times using AF, until a set of images is collected.

The sizes of the COC in the AF images can be measured using the histogram feature of my image analysis software.  By setting a window around the COC, and choosing an appropriate histogram bin level, the software will give a count of the number of pixels (I use only the green channel) in the COC.  If the COC is of a good size - say more than 200 pixels across - the count values will be large and high precision is obtained.

The square root of the pixel count obtained is directly proportional to the distance between the pinpoint light source and the exact lens focus point.  I have found that measurement consistency of 0.1% of this distance is readily achievable when using the above guidelines.  In the setup I have been using this weekend, the distance from AF target to pinpoint source is 340mm, which means I can measure the lens focus position with an uncertainty of 1/3 mm or better.

Setup details and a few results to follow . . .

-- hide signature --

Qualities possessed by God in infinite proportion: Love, Grace, Power, Righteousness, Wisdom, . . .
Qualities possessed by humans in infinite proportion: Ignorance.
- Marianne

Flat view
Post (hide subjects) Posted by
(unknown member)
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow