Running SFRreg (Interactive and Auto mode settings)
Imatest SFRreg performs highly automated measurements of sharpness (expressed as Spatial Frequency Response (SFR), also known as Modulation Transfer Function (MTF)) and Lateral Chromatic Aberration from images that contain registration mark patterns (circles that contain two light and two dark quadrants). This document shows how to run SFRreg in Rescharts and how to save settings for automated runs. Part 1 introduced SFRreg and explained how to obtain and photograph the chart. Part 3 illustrates the results.
- the Desktop,
- the Windows Start menu,
- the Imatest folder (typically C:Program files\Imatest\vm.n\Edition (where m.n is the version, e.g., 4.2, and Edition can be Master, Image Sensor, etc.) in English language installations).
SFRreg operates in two modes: interactive/setup and automatic.
To initiate an interactive SFRreg run (in Rescharts), press then 10. SFRreg or press the Interactive/Postprocessors dropdown menu then SFRreg setup. This opens a dialog box for reading an SFRreg file; pressing is more general; it lets you open any Rescharts module. Either of these buttons allows you to analyze an SFRreg image, examine detailed results interactively, and save settings for the highly automated SFRreg auto runs (or the even more automated Imatest IT EXE or DLL versions). SFRreg should be run at least once interactively prior to the first SFRreg auto run. SFRreg settings can also be updated by pressing Settings, SFRreg Auto settings from the Imatest main window.
The portion of the Rescharts window used for opening files is shown on the right. You can open a file by clicking onif the correct chart type is displayed, or by selecting a Chart type. One or more files may be selected, as shown below. If you select multiple files, they can be combined (averaged), and you’ll be given the option of saving the combined file.
If the folder contains meaningless camera-generated file names such as IMG_3734.jpg, IMG_3735.jpg, etc., you can change them to meaningful names that include focal length, aperture, etc., with the View/Rename Files utility, which takes advantage of EXIF data stored in each file.
The folder saved from the previous run appears in the Look in: box on the top. You are free to change it. The file name from the previous run is displayed at the bottom. You can open a single file by simply double-clicking on it. You can select multiple files for combined runs (for interactive or SFRreg auto runs) or for batch runs (for SFRreg auto-only) by the usual Windows techniques: control-click to add a file; shift-click to select a block of files. Then click . Three image files are highlighted. Large files can take several seconds to load.
|Multiple file selection Several files can be selected in Imatest Master using standard Windows techniques (shift-click or control-click). For SFRreg interactive (Rescharts) runs, files can be combined to reduce noise or (in some instances) observe the effects of camera shake or image stabilization. For SFRreg Auto runs, you can run large batches of images. The multi-image dialog box gives you the option of saving the combined file, which will have the same name as the first selected file with _comb_n appended, where n is the number of files combined.|
|RAW files Imatest can analyze raw files from cameras (using dcraw) or from development systems (using Generalized Read Raw). The files can be demosaiced or converted to Bayer raw: standard files (TIFF, etc.) that contain undemosaiced data. Undemosaiced files are not very useful for measuring MTF because the pixel spacing in each of the four image planes is twice that of the image as a whole; hence MTF is lower than for demosaiced files. But Chromatic aberration can be severely distorted by demosaicing, and is best measured in Bayer RAW files (and corrected during RAW conversion). Details of RAW files can be found here|
When the file (or files) have been opened, the SFRreg setup window, shown below, appears. This window allows you to select groups of regions (ROIs; shown as violet rectangles) for analysis. It also lets you select the size of the regions, whether to analyze vertical or horizontal edges, and much more. Pressingon the left opens the SFRreg More settings, which allows you to select additional settings that affect the calculations and display. Pressing lets you select the output figures and files (for SFRreg auto mode runs).
|SFRreg setup window
|Gamma||Assumed Gamma (contrast) of the chart. Has a small effect on the MTF results. Default is 0.5. Overwritten if the Use for MTF checkbox (below Chart contrast) is checked. Gamma is described in more detail below.
|Channel||Select channel to analyze: R, G, B, Y, R-only, G-only, B-only, Y-only. (Y is Luminance channel). Use one channel only to speed up calculations or where other channels are dark or may not contain valid data. Selecting one channel-only can significantly speed up calculations.
(for gamma calc.)
|Chart contrast– for the contrasty squares (i.e., most of them). Used to estimate gamma from the image.|
|Use for MTF||(Checkbox, normally unchecked) When checked, the gamma derived from the chart is used for the MTF calculation. This may result in a small improvement in accuracy.|
|# of SFRreg targets||Let the algorithm automatically detect the number of SFRreg targets in the image or set the number for increased speed and accuracy.|
|Open the SFRreg More settings window, shown below.|
|Open the SFRreg Auto mode settings window, shown below, for controlling .|
|ROI Selection & analysis area
Selects which regions (ROIs) to analyze. Registration marks are located automatically. Choices below.
These are particularly important settings.
|Vertical Region selection
(Selects which regions to locate. Actual ROIs are located
1. Vertical: All
2. Vertical: Top
3. Vertical: Bottom
3. Vertical: None
|Horizontal Region selection
1. Horizontal: All
2. Horizontal: Left
3. Horizontal: Right
4. Horizontal: None
|Speedup (checkbox)||Speed up the run by eliminating some calculations that many users don’t require, including SQF/Acutance, noise statistics and histograms.|
|ROI size||Slider that determines the size of the ROI. Use the largest value that keeps a save distance from edges of squares and top and bottom bars. May need to be reduced where distortion is severe.|
|Allows borders to be cropped to remove interfering patterns that might otherwise be included in the image. This button is tinted pink whenever the image is cropped.|
(below ROI size slider)
|Width of ROI selection. Normal width for the standard rectangular ROI. Choose Wider or Widest for very fuzzy edges, for enhanced noise analysis, or for more extended low frequency response.|
|Title||Title. Defaults to file name. You can add a description.|
|Open this web page in a web browser.|
|Display … image||Selects image for Setup window display: Original (RGB) image, R, G, or B channel|
|Save settings (for use in auto SFRreg), but do not continue with run.|
|Save settings and continue with run: Calculate results for all selected region. You will be able to view results interactively.|
|Cancel run; do not save settings|
After you’ve finished making settings, clickto save settings and continue with the run. You can Click to save the settings without continuing.
Starting with Imatest 2020.1, ROI numbering should be much more consistent. Prior to 2020.1, ROIs were numbered from inside to outside, regardless of location. That could cause inconsistencies with images similar to the one shown below, which has four registration marks near the corners. Because the corner ROIs all have similar radii (with respect to the image center), small changes in image framing could change the ROI order.
The new ordering algorithm is shown below.
All vertical edges precede all horizontal edges. Registration marks in the center region (which is 20% of the center-to-corner distance) come first if any are present, followed by zones 2-9.
The SFRreg More settings window, shown below, opens when
- is pressed in the SFRreg setup or Rescharts windows.
- Settings, SFRreg settings is pressed in the Imatest main window, then is pressed in the SFRreg setup window.
The settings are read from the imatest-v2.ini file, and saved when SFR input dialog box and also the SFRplus and eSFR ISO More settings windows with several settings removed.is pressed. Settings are similar to settings in the
|You can select either Expert or Simplified mode for the settings window. In Simplified mode many settings are grayed out so they can’t be set. If you press , commonly used settings (recommended for beginners) are selected.|
This window is divided into sections: Title and on top, then Display options, Settings, Optional parameters, and finally, or at the bottom.
Title defaults to the input file name. You may leave it unchanged, replace it, or add descriptive information for the camera, lens, converter settings, etc.— as you please.
opens a browser window containing a web page describing the module. The browser window sometimes opens behind other windows; you may need to check if it doesn’t pop right up.
|Display options (below Plot) contains settings that affect the display (units, appearance, etc.).
MTF plot units selects the spatial frequency scale for MTF plots for for the summary plot. Cycles/pixel (C/P), Cycles/mm (lp/mm), Cycles/inch (lp/in), Line Widths per Picture Height (LW/PH), and Line Pairs per Picture Height (LP/PH) are the choices. (Note that one cycle is the same as one line pair or two line widths.) If you select Cycles per inch or Cycles/mm, you must enter a number for the pixel size— either in pixels per inch, pixels per mm, or microns per pixel. For more detail on pixel size, see the box below. Note: for using picture height (LW/PH) or (LP/PH) units with cropped images enter the original picture height into the more settings dimensions input.
Maximum MTF plot frequency selects the maximum display frequency for MTF plots. The default is 2x Nyquist (1 cycle/pixel). This works well for high quality digital cameras, not for imaging systems where the edge is spread over several pixels. In such cases, a lower maximum frequency produces a more readable plot. 1x Nyquist (0.5 cycle/pixel), 0.5x Nyquist (0.25 cycle/pixel), and 0.2x Nyquist (0.1 cycle/pixel) are available.
Secondary readout controls the secondary readout display in MTF plots. The primary readout is MTF50 (the half-contrast spatial frequency). Two secondary readouts are available with several options. The first defaults to MTF30 (the spatial frequency where MTF is 30%). The third is used only for Lens-style MTF plots.
Clicking Change Readout opens the window shown on the right. Secondary readout settings are saved between runs. Choices:
Edge plot selects the contents of the upper (edge) plot. The edge can be cropped (default) or the entire edge can be displayed. Three displays are available.
Settings affect the results as well as the display.
Speedup Speed up calculatons by eliminating some calculations that many users don’t require, including noise statistics and histograms. Checking Speedup can significantly speed up calculations.
Edge roughness Calculate edge roughness (for inclusing in CSV output). Slows calculations slightly. Required if Edge roughness plot is to be displayed.
MTF noise reduction (mod apod) Reduce noise using the modified apodization technique. Improves MTF accuracy, especially with noisy images, but not an ISO standard calculation. Generally recommended.
Channel specifies the primary channel to display (all channels are analyzed). It’s normally left at it’s default value of Y for the luminance channel,
Gamma (the average slope of log pixel levels as a function of log exposure for light through dark gray tones) is used to linearize the input data, i.e., to remove the gamma encoding applied in the camera or RAW converter. It defaults to 0.5 = 1/2, which is typical of digital cameras, but may be affected by camera or RAW converter settings. Small errors in gamma have little 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 or 0.5 when dcraw is used to convert RAW images into sRGB or a gamma=2.2 (Adobe RGB) color space. It is typically around 1 for raw images that haven’t had a gamma curve applied. 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.
If the chart contrast is known and is ≤10:1 (medium or low contrast), you can enter the contrast in the Chart contrast (for gamma calc.) box, then check the Use for MTF checkbox. Gamma will be calculated from the chart and displayed in the Edge/MTF plot.
If chart contrast is not known you should measure gamma from an image of a grayscale stepchart (a huge variety of grayscale charts is available) by 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.
Wavelength (um) for diffraction-limited MTF plot. If a number is entered (0.555 um is the default for visible light systems) and pixel spacing is also entered, the diffraction-limited MTF is displayed on the MTF plot and the diffraction-limited edge or Line Spread Function (cross-section of Airy disk) is shown on the edge plot as a faint dashed line.
Zone weights Weights of the center, part-way, and corner zones. Used for calculating weighted means of key results, displayed in the Multi-ROI and 3D plots. The defaults of 1 (center), 0.75 (part-war), and 0.5 (corners) are for typical pictorial photography; corners should probably be given more weight for technical photography.
restores the settings in SFRreg More Settings to their default values.
|Additional parameters (all optional) for Excel .CSV output contains a detailed description of the camera, lens, and test conditions. EXIF data is entered, if available, but can be overridden by manual settings. Description & settings is particularly useful for annotating the test system (it is displayed in MTF Compare).These settings are optional but can be useful when several tests are run for different lenses, focal lengths, apertures, or other settings. The settings are displayed next to the MTF plots. They are saved and reused in subsequent runs for files with the same pixel dimensions. If EXIF data is available (currently, only in JPEG files) it overrides the saved settings. The Reset button clears all entries.|
ISO standard SFR If this checkbox is checked, SFR calculations are performed according to the ISO 12233 standard, and the y-axis is labeled SFR (MTF) (ISO standard). This method is slightly less accurate than the normal Imatest calculation, which incorporates a number of refinements, including a better edge detection algorithm and a second-order polynomial fit to the average edge for a more accurate estimate of SFR in the presence of lens distortion. This box is normally left unchecked; it should only be used for comparing normal Imatest calculations to the ISO standard. The difference is typically very small.
Imatest’s automatic detection routines work hard to detect SFRreg targets in an image regardless of size, lighting, distortion, and their placement confusing, busy scenes. However, many real-world test setups will contain scene content that could be mistaken for registration mark targets. This is especially true when the targets are low contrast and the scene is high contrast (containing light and/or dark areas more extreme than the light/dark areas of the SFRreg mark). The following options can help guide SFRreg detection in the case that auto-detection selects too few targets or mis-identifies scene content as a test chart.
Number of SFRreg targets: Setting the number of SFRreg targets in your scene will speed up detection, and will help find the correct number of targets if the auto-detection amount is incorrect. In general, you should set this if possible. (A value of 0 corresponds to “Use auto-determination of the number of SFRreg targets.”)
The following options should be left at their default values if auto-detection is working on your images, as (in general) they will increase runtime.
Minimum SFRreg mark diameter: Set this value, in pixels, to guide the routine to disregard confusing scene content smaller than your SFRreg targets if it is having difficulty doing so by default.
Maximum SFRreg mark diameter: Set this value, in pixels, to guide the routine to disregard confusing scene content larger than your SFRreg targets if it is having difficulty doing so by default.
Contrast Robustness: SFRreg targets that have dynamic range (light area/dark area contrast) significantly smaller than the dynamic range of the rest of the scene will be more difficult to detect. Select from various levels of robustness to low-contrast charts with this menu, at the cost of increased runtime.
Rotation Robustness: SFRreg targets with a -15 to +15 degree rotation are favored by the detection algorithm (in accordance with idea slanted edge rotation for SFR analysis). If targets rotated by a greater amount are not detected, you may use this option to set various levels of robustness to different rotations, at the cost of increased runtime.
When entries are complete, click Calculating… boxes appear to let you know how calculations are proceeding. When calculations are complete, results are displayed interactively in the Rescharts window, as shown below.to return control to the SFRreg setup window or to save settings and return to the Imatest main window. When all entries are complete, click either , , or . saves the settings for use in automated SFRreg runs, which can be initiated from the button in the main Imatest window. saves the settings then calculates results for interactive viewing. A sequence of
Auto mode settings affect plots and output files for SFRreg Auto runs as well as Imatest IT/EXE and DLL.It does not directly affect interactive (Rescharts) SFRreg runs. The SFRreg Auto mode settings window, shown below, opens when
- Auto mode settings is pressed in the SFRreg setup window.
- More settings is pressed in the Rescharts window, then Switch to SFRreg Auto mode setup is pressed in the More settings window.
- Settings, SFRreg Auto settings is pressed in the Imatest main window.
The upper box allows you to select single and multi region figures to be plotted and saved in SFRreg auto output. For the most part they are self-explanatory. Note that all plotted figures are saved.
Saved figures, CSV, XML, and JSON files are given names that consist of a root file name (which defaults to the image file name) with a suffix added. Examples:
When 3D plot is checked, SFRreg auto plots the last 3D plot displayed in Rescharts unless the button has been pressed and one or more plots has been selected. More 3D plots will be displayed in pink in this case. This allows several 3D plots to be displayed and saved by SFRreg auto.
Close figures after save should be checked if a large number of figures are to be displayed. It prevents a buildup of figures, which can slow processing.
Figures can be saved as PNG or FIG files. PNG files (a losslessly-compressed image file format) are the default— they require the least storage. Matlab FIG files allow the data to be manipulated– Figures can be resized, zoomed, or rotated (3D figures-only), but FIG files should rarely be used because they can be huge. PNG files are preferred if no additional manipulation is required.
A CSV summary file is saved for all runs. An XML file is saved if Save XML results is checked.
You can select either Save CSV files for individual ROIs or Save summary CSV file only (the summary file is always saved).
Save folder determines where results are stored. It can be set either to subfolder Results of the image folder or to a folder of your choice. Subfolder Results is recommended because it is easy to find if the image folder is known.
|A Clipping warning is issued if more than 0.5% of the pixels are clipped (saturated), i.e., if dark pixels reach level 0 or light pixels reach the maximum level (255 for bit depth = 8). This warning is emphasized if over 5% of the pixels are clipped. Clipping reduces the accuracy of SFR results. It makes measured sharpness better than reality.||
|The percentage of clipped pixels is not a reliable index of the severity of clipping or of MTF measurement error. For example, it is possible to just barely clip a large portion of the image with little loss of accuracy. The plot on the right illustrates strong clipping, indicated by the sharp corner near the “shoulder” on the black line. The MTF measurement is better than reality. The absence of a sharp corner indicates that there is little MTF error.Clipping can usually be avoided with a correct exposure— neither too dark nor light— and by avoiding high contrast targets (like the old ISO-12233 chart). The maximum recommended edge contrast is 10:1; 4:1 contrast (recommended in the upcoming revision to the ISO-12233 standard) is even better. Low-contrast targets are more reliable overall: in addition to better exposure latitude (reduced risk of clipping), they tend to have less sharpening in cameras with variable signal processing, and MTF results are less sensitive to errors in estimating gamma.||
- SFRreg analyzes images of registration mark patterns, which may be obtained from the Optikos Meridian compact projection system (where the images may be focused at infinity) or from an array or printed patterns, which can work with extreme wide angle fisheye lenses. There should be few or no interfering patterns (resembling registration marks) outside the registration mark charts.
- Lighting should be even and glare-free. Lighting and alignment recommendations are given in The Imatest test lab.
- The first time SFRreg is run, it should be run through Rescharts. This allows
- parameters to be adjusted and saved for later use in the automatic version of SFRreg, which is opened by pressing Fixed modules (dropdown menu), SFRreg Auto in the Imatest main window.
- results (listed above) to be examined interactively in the Rescharts window.
Pixel size is closely related to image quality. For very small pixels, noise, dynamic range and low light performance suffer. Pixel size is rarely given in camera spec sheets: it usually takes some math to find it. If the sensor type and the number of horizontal and vertical pixels (H and V) are available, you can find pixel size from the table on the right and the following equations.
pixel size in mm = (diagonal in mm) / sqrt( H2 + V2 )
Pixel size in microns (microns per pixel) can be entered directly into the SFR settings box. Example, the cute little 5 megapixel Panasonic Lumix DMC-TZ1 has a 1/2.5 inch sensor and a maximum resolution of 2560x1980 pixels. Guessing that the diagonal is 7 mm, pixel size is 2.1875 (rounded, 2.2) microns.You can find detailed sensor specifications in pages from Sony, Panasonic, and Kodak.