Gamma, Chart Contrast and MTF Calculations

A fuller and more up-to-date explanation of gamma,
including how to obtain it for slanted-edge MTF calculations

can be found on Gamma, Tonal Response Curve, and related concepts.

Gamma (the average slope of log pixel levels as a function of log exposure for light through dark gray tones) is used, per the ISO 12233 standard, to linearize the input data, i.e., to remove the gamma encoding applied by the camera or RAW converter. Gamma defaults to 0.5 = 1/2, which is typical of digital cameras, but may be affected by camera or RAW converter settings. 

Imatest Settings

For accurate calculation of edge-SFR from using Imatest’s SFRplus, eSFR ISO, SFRreg, Checkerboard, or SFR modules, it’s important to use a proper gamma for sharpness calculations.

If the edge contrast is known and is ≤ 10:1 (medium or low contrast), you can enter the edge contrast in the Chart contrast (for gamma calc.) box, then check the Use for MTF checkbox. Gamma will be then be calculated for each individual edge in the chart image and displayed in the Edge/MTF plot. Full details, including the equation, are on Gamma and MTF Measurement.

Measuring Gamma

If chart contrast is not known you should measure gamma by obtaining the OECF (Opto-Electric Conversion Function) per the ISO 14524 standard.  This can be obtained using an image of a grayscale stepchart and running Colorcheck, Stepchart , Multicharts (interactive), or Multitest. A nominal value of gamma should be entered, even if the value of gamma derived from the chart (described above) is used to calculate MTF.

Errors in Gamma

Small errors in gamma have a minor effect on MTF measurements (a 10% error in gamma results in a 2.5% error in MTF50 for a normal contrast target). Gamma should be set to 0.45 when dcraw is used to convert RAW images into sRGB or a gamma=2.2 (Adobe RGB) color space. If gamma is set to less than 0.3 or greater than 0.8, the background will be changed to pink to indicate an unusual (possibly erroneous) selection.

Technical Details

Capture One LE with Film Curve
1. Capture One LE set to Film standard
(the default). Gamma = 0.679.

Capture One LE with Linear Curve
2. Capture One LE, Linear response. Gamma =
0.508. Recommended for SFR runs.

Canon FVU with Standard contrast

3. Canon FVU set to Standard contrast.
Gamma = 0.642.

Gamma is the exponent of the equation that relates image pixel level to luminance. For a monitor or print,

     Output luminance = (pixel level)gamma_display

When the raw output of the image sensor, which is linear, is converted to image file pixels for a standard color space, the approximate inverse of the above operation is applied.

     pixel level = (RAW pixel level)gamma_camera ~= exposuregamma_camera

The total system gamma is gamma_display * gamma_camera. Standard values of display gamma are 1.8 for older color spaces used in the Macintosh and 2.2 for color spaces used in Windows, such as sRGB (the default) and Adobe RGB (1998).

The three curves on the right, produced by Stepchart for the Canon EOS-10D, show how Gamma varies with RAW converter settings.In characteristic curves for film and paper, which use logarithmic scales (e.g., density (–log10(absorbed light) vs. log10(exposure)), gamma is the average slope of the transfer curve (excluding the “toe” and “shoulder” regions near the ends of the curve), i.e.,

Gamma is contrast.

See Kodak’s definition in Sensitometric and Image-Structure Data.

To obtain the correct MTF, Imatest must linearize the pixel levels— the camera’s gamma encoding must be removed. That is the purpose of Gamma in the SFR input dialog box, which defaults to 0.5, typical for digital cameras. It can, however, vary considerably with camera and RAW converter settings, most notably contrast.

Characteristic curves for the Canon EOS-10D with three RAW converter settings are shown on the right. Gamma deviates considerably from 0.5. Gamma = 0.679 could result in a 9% MTF50 error. For best accuracy we recommend measuring gamma using Colorcheck or Stepchart, which provides slightly more detailed results.

Confusion factor: Digital cameras rarely apply an exact gamma curve: A “tone reproduction curve” (an “S” curve) is often superposed on the gamma curve to extend dynamic range while maintaining visual contrast. This reduces contrast in highlights and (sometimes) deep shadows while maintaining or boosting it in middle tones. You can see it in curves 1 and 3, on the right. For this reason, “Linear response” (where no S-curves is applied on top of the gamma curve) is recommended for SFR measurements.

The transfer function may also be adaptive: camera gamma may be higher for low contrast scenes than for contrasty scenes. This can cause headaches with SFR measurements. But it’s not a bad idea generally; it’s quite similar to the development adjustments (N-1, N, N+1, etc.) in Ansel Adams’ zone system. For this reason it’s not a bad idea to place a Q-13 or Q-14 chart near the slanted edges.

To learn more about gamma, read Tonal quality and dynamic range in digital cameras and Monitor calibration.

Read More

How to store and retrieve region (ROI) selections

Full up-to-date documentation on region selection and how to use ROI files is now on
Saving and Retrieving Regions of Interest (ROIs)

Imatest can store Regions of Interest (ROIs) for most modules that use manual region selection.

Regions of Interest can be stored in small named ini files that only contain region information, and can be retrieved whenever needed.

This can be done for most modules that use manual region selection (even when automatic selection is an option). These modules include

SFR, Colorcheck, Dot Pattern, Distortion, Multicharts, Multitest, Random/Dead Leaves, Log Frequency-Contrast, Star, and Wedge, and Rescharts (with the four preceding modules)

Stepchart (with a restriction: method 1 (below) should not be used)

[Omitted: Blemish Detect, Uniformity, which usually use the entire image. Automatically detected Rescharts modules like SFRplus and eSFR ISO ]

Saving the region selection

The ROI can be saved by one of the following methods.

1. The Save ROI settings… button in the settings window

When you open a module, select a Region of Interest, then press Yes (not Express mode), a settings window opens that that contains a Save ROI settings… button, typically located somewhere in the Settings section. Its location is not consistent: it can be different for different modules. This method is not recommended for Stepchart*. Examples:

Save ROI settings… button for Random/Dead Leaves and SFR modules

2. The Save ROI settings… button in the Save results window that typically appears when a run is complete.

3. From the Imatest, Multicharts, or Rescharts windows:

INI File Settings –> Save ROI Settings can save settings from the most recently run module (if you didn’t save it in the Settings window).

*The Stepchart Settings window differs from other modules in that it lets you select the grayscale chart type. The Fine ROI adjustment window opens after the Settings window, so it is never a good idea to save the ROI from the Stepchart Settings window. You can set it afterwards with methods 2 or 3 (described above). This is one of several reasons that Multicharts and Multitest (which can analyze color as well as grayscale charts and display more noise detail) are recommended.


Selecting Save ROI settings… opens a window that lets you select the file for saving the ROI settings.

Save ROI settings window

The Optional Navigation Area assists with navigation: It affects the initial folder that appears when you click Save ROI Settings. The ROI settings INI file contents list box displays the ROI file contents, described in the gray box below. When you press Save ROI settings you can navigate to the desired folder and specify the file name.

All modules except for SFR and Wedge store image width (nwid_save), height (nht_save), and Regions of Interest (roi) for up to 20 recently-run images (where images are distinguished by their height and width). The most recent image size is first. Each image has a single width and height and either 4 or 8 numbers describing the ROI. SFR and Wedge store multiple regions for a single image.

4 ROI numbers, sufficient for describing rectangles, are used in SFR, Wedge, Dot Pattern, Distortion, Uniformity, and Blemish Detect. Each set of four numbers consists of [UL(x) UL(y), LR(x), LR(y)], where UL = Upper-Left and LR = Lower-Right (location in pixels relative to the upper-left corner of the image).

8 ROI numbers, sufficient for describing four-sided polygons (quadrilaterals), which generally contain inner rectangles, are used in all other modules. Each set of eight numbers consists of [UL(x) UL(y), LR(x), LR(y), UR(x), UR(y), LL(x), LL(y)].

Retrieving the region selection

Because the region selection window opens first for most modules (before the Settings window) you need to load the ROI before running the module. This can be done from the Imatest, Multicharts, or Rescharts windows by clicking

INI File Settings –> Load (merge) ROI Settings

This opens the following window that lets you select a previously-saved INI file. It will be merged into the main INI file (imatest-v2.ini, unless otherwise specified).

Load ROI settings window

The upper box (OPTIONAL NAVIGATION AREA) assists with navigation by helping to locate the initial location for reading the ROI Settings file. It is completely optional and may be ignored.

Loading the region requires three steps.

  1. Press 1. Read ROI Settings file.  You can specify the actual file location to load in the Open dialog box.
  2. Examine the contents of the ROI settings file, which are displayed when the file is loaded.
  3. Press 3. Load (Merge ROI Settings). If this operation is successful a message will be displayed to the right of the button.
Read More