LSF correction factor for slanted-edge MTF measurements

April 1, 2015
March 17, 2021

A correction factor for the slanted-edge MTF (Edge SFR; E-SFR) calculations in SFR, SFRplus, eSFR ISO, SFRreg, and Checkerboard was added to Imatest in 2015. This correction factor is included in the ISO 12233:2014 and 2017 standards, but is not in the older ISO 12233:2000 standard. Because it corrects for an MTF loss caused by the numerical calculation of the Line Spread Function (LSF) from the Edge Spread Function (ESF), we call it the LSF correction factor.

EquationsApplying the correction factorVerification 

The LSF correction factor primarily affects very high spatial frequencies beyond most of the energy for typical high quality cameras. But it does make a difference for practical measurements: MTF50 for a typical high quality camera (shown below) is increased by about 1.5%.

The correction factor is turned on by default in Imatest 4.2+. It is set by pressing Settings, Options III in the Imatest main window as shown below, then checking the box for the correction. We strongly recommend leaving on the LSF correction factor, i.e., the box should be checked.

Because the LSF correction factor used by Imatest is derived from first principles, and not from the equations in the standards, which contain misprints, the correction factor in Imatest versions starting with 4.2 in 2015 corresponds to the intent of both the ISO 12233:2014 and 2017 standards.

 
More details about Imatest’s ISO compliance can be found on the Sharpness web page.

Equations

Here is the Edge SFR (MTF) equation from ISO 12233:2000, Annex C:

iso-12233-2000-SFR_eqn

© ISO 2000 – All rights reserved


Here is the corresponding equation from ISO 12233:2014, Annex D. Note that E-SFR(k) is the symbol for edge-based SFR, not a subtraction:

© ISO 2014 – All rights reserved


And here is the corresponding equation from ISO 12233:2017 Annex D. 

© ISO 2014 – All rights reserved© ISO 2014 – All rights reserved

© ISO 2017 – All rights reserved


The difference between the 2014 and 2017 equations is the LSF (Line Spread Function) correction factor D(j) (D(k) in ISO 12233:2017), which corrects for the numerical differentiation used to calculate LSF (not the point spread function) from the Edge Spread Function. Note that D(j) (or D(k) ) are incorrect in both the 2014 and 2017 standards. It should read,

\(D(k) = \text{min}\left[\frac{\pi k / N}{\sin\left(\pi k / N\right)}, 10\right]\) *If you thought ISO standards were written by gods on
Mount Olympus, the many misprints should set you straight.

 

Numerical differentiation is a linear process with a transfer function
that differs from ideal differentiation.

The ISO 12233:2014 and 2017 formula (D.8) for calculating the Line Spread Function LSF(x) from the 4x-oversampled Edge Spread Function ESF(x) is,

\(\displaystyle LSF_W(j) = W(j)\frac{ESF(j+1) – ESF(j-1)}{2}\)

where W(j) is a windowing function not relevant to this analysis. Note that the difference spacing Δx in this calculation is 2 (4x-oversampled) samples = 0.5 pixels. This numerical difference formula may be rewritten,

\(\displaystyle LSF(x) = \frac{ESF(x + \Delta x/2) – ESF(x – \Delta x/2)}{\Delta x}\)     where Δx  = 0.5 pixels.

The Fourier transform (FT) for a time (or spatial) shift a is given in Wikipedia.

\(FT(g(x-a)) = e^{-ia\omega} FT(g(x)) \)

For numerical differentiation, the Fourier transform is

\(\displaystyle FT_{numerical} = \frac{FT(g(x+a/2)-g(x-a/2))}{a} = \frac{e^{ia\omega/2}-e^{-ia\omega/2}}{a}FT(g(x))\)

Noting that  \(\sin(x) = \frac{e^{ix}-e^{-ix}}{2i}\)  (see Wikipedia),

\(\displaystyle FT_{numerical} = \frac{2\sin(a\omega /2)}{a}FT(g(x))\)

For pure differentiation, the Fourier transform is

\(\displaystyle FT_{pure} = FT\left(\frac{d g(x)}{dx}\right) = \omega FT(g(x))\)

The correction factor is therefore

\(\displaystyle D(\omega) = \left|\frac{FT_{pure}}{FT_{numerical}}\right| = \frac{a\omega /2}{\sin(a\omega /2)}\)

Since Δx = a = 0.5 pixels for the 4x-oversampled signal, and frequency f = ω/(2π) has units of cycles/pixel,

\(\displaystyle D(f) = \left|\frac{FT_{pure}}{FT_{numerical}}\right| = \frac{\pi f/2}{\sin(\pi f/2)}\)

At the Nyquist frequency, fNyq = 0.5 Cycles/Pixel, \(D = \frac{\pi /4}{\sin(\pi /4)} = 1.1107\). At 2*Nyquist = 1 C/P, D = π/2 = 1.5708.  To obtain D(k), substitute πk/N for /2.  min[…, 10] keeps D(j) from becoming excessive where (πk/N ) >> sin(πk/N ).

Applying the correction factor

The LSF correction factor is enabled by default. To check or change the setting, click Settings (in the Imatest main window), Options III. You can check or uncheck the Use LSF… checkbox as appropriate, but we recommend leaving it checked. The checkbox sets derivCorr in the [imatest] section of imatest-v2.ini to 0 (correction off) or 1 (correction on).

Options III window for applying or removing LSF correction factor

slant_ideal_angle5.00_light200_dark_20Verification

To observe the effects of the LSF correction factor, we use an idealized edge, tilted 5 degrees, shown on the right. You can click on it to download it for your own testing.

The ideal edge increases uniformly from 0 to 1 over a distance of τ = 1 pixel.

The MTF of an ideal uniformly-increasing edge of width τ is the Fourier transform FT of its derivative, which is

\(\displaystyle f(t) = \frac{u\left((t+\tau) / 2\right) – u\left((t-\tau) / 2\right)}{\tau}\)     for unit step function u.

\(\displaystyle FT(f) = \frac{\sin(\pi \tau f)}{\pi \tau f}\)

If τ is the sampling rate (the same as Δx or a in the green box, above),

\(\displaystyle\textrm{Nyquist frequency} = f_{\textrm{Nyq}} = \frac{1}{2\tau}\)

The expected value of MTF at the Nyquist frequency (0.5 cycles/pixel) is

\(\displaystyle FT(f_{\textrm{Nyq}}) = \frac{\sin(\pi\tau f_{\textrm{Nyq}})}{\pi\tau f_{\textrm{Nyq}}} = \frac{\sin(\pi /2)}{\pi /2} = \frac{2}{\pi} = 0.6366\)

Here are the results without and with the LSF correction factor. Note that gamma has been set to 1 because the idealized image is not gamma-encoded. The results with LSF correction are much closer to the expected value of 2/π = 0.6366. The difference is likely due to digital sampling and the numerical binning/oversampling process: the average oversampled edge shown in the figures below is slightly rounded. Also, the edge rotation correction that is not applied to edges slanted by less than 8 degrees. The edge rotation is not included in the ISO standard and so is not applied to edges that fall under the ISO standard algorithm.

MTF_ideal_no_LSF_correctionIdeal edge, uncorrected MTF.
MTF@Nyquist = 0.56.
MTF_ideal_LSF_correctedIdeal edge, LSF-corrected MTF.
MTF@Nyquist = 0.624.

 

The figure on the right, generated by MTF Compare (a postprocessor to MTF calculation programs for comparing MTF calculations), compares the uncorrected MTF of the ideal edge (blue) with the corrected MTF (burgundy).

The black line is the uncorrected/corrected transfer function = 1/(correction factor D). It has the expected values of 0.9 (1/1.1107) at the Nyquist frequency (f = 0.5 C/P) and 2/π = 0.6366 at 2*Nyquist (1 C/P).

MTFcompare_LSF_correctionMTF Compare Uncorrected vs. Corrected

 

Effects of gamma

Most color space files are gamma-encoded with gamma around 0.5, which is the default for Imatest slanted-edge SFR calculations. (Actual gamma varies considerably, and may be complicated by a tonal response curve on top of the gamma curve.)  However, the ideal pulse is not gamma-encoded, so gamma = 1 is the appropriate setting. If gamma is set to 0.5 (the default), an inappropriate linearization will be applied to the edge, resulting in erroneous results: the MTF at 2*Nyquist is not equal to 0, as it should be.

MTF_ideal_gamma5_no_LSF_correctionIdeal edge, uncorrected MTF, calculated
(incorrectly) with gamma = 0.5

The idealized image has much more energy above the Nyquist frequency than typical high quality images. Here is an example for a high quality camera showing the effects of the LSF correction factor on MTF50— the most commonly-used summary metric.

MTF_GF1_no_LSF_correctionTypical edge, uncorrected MTF.
MTF50 = 0.355 Cycles/Pixel.
MTF_GF1_LSF_correctedTypical edge, LSF-corrected MTF.
MTF50 = 0.360 C/P:  1.41% higher.

 The difference may not be significant for many applications.

Consistency with older Imatest versions

The new correction factor is turned on by default in Imatest 4.2+ releases.

You can override the default, i.e., turn the correction factor on or off, by clicking Settings (in the Imatest main window), Options III, and checking or unchecking the Use LSF… checkbox as appropriate. Once the setting is saved, it will be retained across all future versions unless changed by the user. The default calculation be selected unless you manually change it in Options III window.

We strongly recommend leaving on the LSF correction factor, i.e., the box should be checked.

For industrial testing with pass/fail thresholds set up with the old calculation, we recommend either:

  • adjusting your pass/fail specification to account for the measurement change
  • continuing to use the old calculation by setting devCorr = 0 in the [imatest] section of the ini file

For example, on an ideal edge MTF at Nyquist/4 (0.125 C/P, a common KPI) is only increased by 0.64%,  at Nyquist/2 (0.250 C/P) MTF is increased by 2.80%. On an actual sharp, RAW camera-phone image with Gamma=1, the MTF at Nyquist/4 is increased by 0.81%, MTF at Nyquist/4 is increased by 3.00%.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.