Documentation

SFRplus Distortion and Field of View measurements

Introduction

SFRplus (Imatest 3.10+) provides distortion and Field of View (FOV) measurements. Its capabilities equal the Distortion module in most areas and exceed it for extremely barrel-distorted (fisheye) lenses. Features introduced in Imatest 3.10 are described: the Use best of above distortion selection and the Distortion correction checkbox.

Pre-distorted charts

The Imatest SFRplus module can handle moderately distorted images but it fails for extremely barrel-distorted images. (We’ve never seen an extremely pincushion-distorted image.) To handle this we provide charts that are distorted inversely to lens distortion, i.e., have pincushion distortion. For testing a fisheye lens you should select a chart that has the approximate inverse of the lens distortion; it doesn’t have to be precise. When the correct chart is chosen the chart image will have low enough distortion to be properly analyzed. Although Imatest can analyze images with significant amounts of distortion, many currently-available lenses, some with fields of view of 180 degrees or more (not uncommon in the automotive industry), go far beyond the capability of Imatest with standard (undistorted) charts.

The Imatest store offers several pre-distorted SFRplus charts that enable SFRplus to work with highly barrel-distorted (fisheye) lenses. These charts can be purchased from the Imatest store or printed from SVG files created with the Imatest Test Charts module (though we only recommend printing your own chart if you have a photographic-quality wide-body printer, a knowledge of color management, and skill in operating the printer). Here is an example of a pre-distorted chart.

Test Charts window for creating a highly pre-distorted SFRplus chart

Note the two distortion parameters at the lower-right of the image: [1.167 1.577]. These must be entered in the More settings window for SFRplus analysis to obtain correct distortion and Field of View (FoV) measurements.

Running SFRplus & Algorithm

Distortion measurements are a part of standard SFRplus runs. You can follow the standard SFRplus instructions, but there are a few measurements you’ll need to pay attention to. These are set in the More settings window, which can be accessed from the SFRplus settings window (that appears whenever SFRplus is run) or from the Rescharts window (at any time).

SFRplus settings that affect distortion and Field of View calculations

Bar-to-bar Chart height cm. Must be entered to calculate the Field of View in cm.

Lens-to-chart distance cm. Must be entered along with Bar-to-bar chart height to calculate angular Field of View in degrees.

Distortion parameters You should enter the numbers printed in light gray (to not interfere with bar detection) on the lower-right of the chart. Typical values are [0.8333 1.123] for the standard pre-distorted chart and [1.167 1.577] for the extra pre-distorted chart. Use the default values of [0 0] for undistorted charts. Charts with custom distortion (selected by clicking Normal custom distort in the Invert Lt/Dk, Distortion, Special… dropdown menu) have different values.

Distortion calculation selects the equation to use for calculating SMIA TV distortion (a summary metric) and Field of View, both of which involve extrapolating distortion beyond the bars. The fourth selection, Use best of above, is generally recommended.

Imatest uses three models of distortion. Both are normalized to the center-to-corner distance.

  1. 3rd order ru = rd + k1 rd3 where ru is the undistorted radius; rd is the distorted radius. Both values of r are normalized to the center-to-corner distance. k1 = 0 for no distortion; k1 < 0 for pincushion distortion; k1 > 0 for barrel distortion.
    3rd order distortion is the simplest: it corresponds to the classic seidel aberration. It works well for small amounts of distortion, but fails for large amounts. It generally fails when pre-distorted charts are used.
  2. 5th order ru = rd + h1 rd3 + h2 rd5
    5th order distortion generally provides more accurate results than 3rd order distortion, though the optimizer sometimes doesn’t work as well as for 3rd order. It is the best equation for “mustache” or “wave” distortion (where the predominant distortion switches from barrel to pincushion along the radius).
  3. arctangent/tangent (arctan/tan)
    ru = tan(10 p1 rd )/ (10 p1 ) ; k1 > 0 (barrel distortion)
    ru
    = tan-1(10 p1 rd )/ (10 p1 ) ; k1 < 0 (pincushion distortion)
    Arctan/tan is the best representation for distortion in standard fisheye lenses, though we’ve seen some strange lenses that fit 5th order better.

Algorithm: The optimizer for calculating the distortion coefficients (k1 for 3rd order; h1 and h2 for 5th order; p1 for arctan/tan) is run for each equation. It works by finding the straightest top and bottom bars and the most even distances between the left edges and right edges of the squares in the center row of the SFRplus chart. The optimizer returns a residual error— the square root of the sum of the squares of the errors. This number is a reliable, robust indicator of how well the optimizer worked. When Use best of above is selected for the distortion calculation, the calculation with the lowest residual error is selected. This choice is strongly recommended because it is not always possible to predict which equation will give the best solution (though it’s occasionally obvious– 5th order works best for visible “mustache” or “wave” distortion).

Results

SFRplus distortion results are located in the 8. Image, Geometry, Distortion, FoV display.

SFRplus Image results, showing distortion and Field of View.

The three sets of distortion coefficients (3rd order, 5th order, and arctan/tan) are shown in the second line below the image.

SMIA* TV Distortion (barrel or pincushion), the selected equation (5th order in the above image) and the Distortion parameters (for non-zero values— pre-distorted charts-only) are shown in the third line. If Use best of above was selected in the Distortion calculation dropdown menu, the actual selected calculation is shown. [*SMIA is the now-defunct “Standard for Mobile Imaging Architecture”, started by Nokia and STMicroelectronics in 2004.]

TV Distortion from the SMIA specification, §5.20. Referring to the image on the right,

SMIA TV Distortion = 100( A-B )/B ; A = ( A1+A2 )/2

The box on the right is described in the SMIA spec as “nearly filling” the image. Since the test chart grid may not do this, Distortion uses a simulated box whose height is 98% that of the image. Note that the sign is opposite of k1 and p1. SMIA TV Distortion > 0 is pincushion; < 0 is barrel.

Algorithm: SMIA TV Distortion is not actually calculated from the upper and lower bars, whose locations can vary considerably in different images. Instead it is calculated from the distortion coefficients: using the selected equation, using virtual horizontal lines located 1% of the image height below the top and above the bottom of the image.

TV distortion: traditional definitionSMIA vs. traditional TV distortion

SMIA TV distortion is twice as large (2X) as traditional TV distortion. The traditional definition, shown on the right, has been adapted from the publication “Optical Terms,” published by Fujinon. The same definition appears in “Measurement and analysis of the performance of film and television camera lenses” published by the European Broadcasting Union (EBU).

At Imatest we prefer the SMIA definition, which has been widely adopted in the mobile imaging industry, because it is self-consistent. In the traditional definition, TV distortion is the change (Δ) of the center-to-top distance divided by by the bottom-to-top distance. In the SMIA definition, both A and B are bottom-to-top distances.

However the traditional TV distortion is likely to be included in an upcoming ISO standard. When this happens we’ll offer a choice (a checkbox).

Distortion correction display

Clicking the Distortion correction checkbox displays the chart image with distortion corrected. Different distortion calculations (3rd order, 5th order, arctan/tan) may be compared. Note: For large images, the display may be very slow when Distortion correction is checked.

  • If nonzero Distortion parameters have been entered, the original chart is displayed. This may not be useful for visual judgment, but the chart edges, if visible, will be straight in this case.

Distortion correction checked, Distortion parameters kept for the standard pre-distorted chart.
The chart edges (shown inside the red ellipses at the bottom) have been straightened.

This image may be compared with the standard pre-distorted chart, shown on the right. Note that the square aspect ratio is rather odd for this image— squares are wider than they are high.

  • If Distortion parameters are set to zero, the straight lines calculated by the optimizer will be shown, but the distortion coefficients, SMIA TV distortion, and Fields of View will be incorrect. Use this only for a visual indication of how well the optimizer is working.

Distortion correction checked, Distortion parameters set to 0.
The top and bottom bars have been straightened.

Summary: Imatest SFRplus has powerful distortion calculation capabilities. It can select the best of three available distortion equations (any of which may be the best for a given lens). The Distortion correction checkbox allows the distortion calculation to be visually checked for effectiveness.

Radial distortion plot

The radial distortion plot (heavily revised in Imatest 4.2; selected with 16: Radial Distortion plot) adds considerable detail to results in the 8. Image, Geometry, Distortion, FoV display. This plot has two display options:  1. Delta-r, or 2. Lens Geometric Distortion, which is shown below.

sfrplus_radial_distortionSFRplus Radial Distortion figure showing Δr (upper plot), magnification (lower plot)

The plot contains either

  • the change in radius Δr (normalized to the center-to-corner distance, i.e., the half-diagonal) as a function of the distorted (input) radius rd.

Δr = r(undistorted) – r(distorted) = rdru

  • Lens Geometric Distortion (LGD), which is included in the CPIQ Phase 2 specification, and is equivalent to Optical Distortion (defined by Edmund Optics).

LGD = 100% ( rdru)/ru

The bold solid lines show Δr or LGD for correction formulas: ru = rd + k1 rd3 (3rd order; blue); ru = rd + h1 rd3 + h2 rd5 (5th order; green); or the arctan/tan equations (red). With these equations |Δr| often increases as a function of r(distorted), i.e., it tends to be largest near the image corners. The selected value (or the one with the least error, err) is shown in boldface.

Comparison with Distortion and Dot Pattern modules

A set of images for comparing different Imatest distortion calculations can be downloaded by clicking on distortion_comparison_barrel_pin.zip. These images were created by the Test Charts module, converted to bitmaps of the same size (if needed), then equally distorted. The zip file includes barrel and pincushion-distorted images for Distortion, Dot Pattern, SFRplus, and eSFR ISO. As the Lens Geometrical Distortion figures for the three modules show, agreement is excellent. The Dot Pattern module uses the algorithm specified in the Camera Phone Image Quality (CPIQ) specification, but the other modules produce equivalent results.

Images are shown reduced. Click on the image to view full-sized.

distortion_comparison_Distortion_barrel distortion_comparison_dotpattern_barrel distortion_comparison_sfrplus_barrel
Distortion module Dot Pattern SFRplus

Notes: the third order calculations (Distortion and SFRplus) are less accurate than the fifth order and arctan/tan calculations (i.e., they cannot be as good a fit to the actual distortion.) The green line (SMIA TV Distortion) in the Dot Pattern figure cannot be compared with the other figures.

Some interesting observations:

  • SMIA TV distortion may not be reliable for highly-distorted (extreme fisheye) lenses, especially when the image circle of the lens is inside the image. In some cases when the answer seems to be unreliable, “NaN” is returned for SMIA TV distortion.
  • “Mustache distortion” may appear when the two 5th order coefficients have the opposite sign.