Introduction

Note: This documentation is preliminary-- simulated results are shown.

Random (scale-invariant), which uses the Rescharts interface, measures SFR (Spatial Frequency Response) or MTF (Modulation Transfer Function) from scale-invariant random (or nearly random) test chart patterns. An example that attracted considerable attention at the Electronic Imaging 2010 conference is the "Dead Leaves" pattern, which is nearly (though not exactly) scale-invariant.These patterns are of interest because they are much less affected by sharpening than other patterns (especially the slanted-edge), and hence can provide estimates of rendered detail that correlate better with perceptual observations, particularly for fine texture.

Scale-invariant means that the pattern statistics (especially frequency spectrum and contrast) are independent of magnification, i.e., do not vary with camera-to-target distance. This greatly simplifies setup and analysis. This requirement is met by random (or nearly random) patterns that have a 1/f frequency spectrum (a 1/f 2 Power Spectral Density (PSD) ). Charts with such a pattern can be generated by Imatest Test Charts or purchased from Imatest.

The scale-invariant test chart

Random scale-invariant test chart
Complete test target with random scale-invariant pattern in center

The chart consists of several patterns. The random pattern in the center occupies the majority of the real estate.

Algorithm:  The chart starts out as a uniformly distributed random pattern with values between 0 and 1. It is then transformed into 2D frequency domain and the magnitude of the FFT is forced to have a 1/f frequency spectrum. Next it is then transformed back to spatial domain and its contrast and mean level are adjusted according to the Test Charts settings described below.

The two smooth regions on the left are used to measure the noise Power Spectral Density (PSD) so it can be subtracted from the PSD of the scale-invariant random pattern in the center, which consists of signal + noise. This procedure is described in Equation (6) of "Texture-based measurement of spatial frequency response using the dead leaves target: extensions, and application to real camera systems" by Jon McElvaina, Scott P. Campbell, Jonathan Miller, and Elaine W. Jin, presented at Electronic Imaging 2010.

The average density of the two patterns is the same as the average of the scale-invariant random pattern. The brightness ratio is 2:1. The patterns are separated by a slanted-edge (approximately 5.7 degrees) that can be analyzed with SFR (or Rescharts Slanted-Edge SFR) for comparison. A vertical slanted edge with the same contrast is located on the upper-right of the chart.

Finally, the right side of the chart contains a 16-patch grayscale step chart with a density increment of 0.1, which is used to determine the image's tonal response and linearize the image.

As of Imatest 3.7, only a pure random version of the target is available. Because this pattern has few regular edges This pattern provides an excellent

Creating and photographing the chart

The first step in running Random is to obtain or create a test chart. A TIFF file that can be used to print a test chart can be created using  Imatest Test Charts. Typical settings are shown below.

Warning: Do not attempt to print a chart unless you have a high quality photographic printer and you understand color management! Poorly printed charts wil produce erroneous results.

Test chart settings for Random pattern
Test Charts settings for standard scale-invariant random pattern

In the standard random chart, shown above, the scale-invariant random pattern occupies the middle 75% of the image. The right side contains a 16-patch gayscale step chart, with densities in increments of 0.1, and a low contrast (2:1) slanted edge whose average density equals that of the random pattern. The slanted edge can be run with SFR for comparison. The left side contains two patches for measuring noise (for subtracting noise Power Spectral Density from the random pattern PSD).

Complete image including slanted edges and log f-Contrast charts
Image with random scale-invariant pattern (to be added)

The image above used to illustrate the Random module and to compare results with Slanted-edge SFR. It was captured with a Canon EOS-40D camera, 24-70mm f/2.8L lens set at 50mm, f/5.6, ISO 100. It includes Star, Log Frequency-Contrast and slanted-edge charts with high and low contrast (20:1 and 2:1).

Mount the chart on a flat dark board— 1/2 inch foam board works well; thinner board warps more easily. Depending on the number of horizontal pixels in the chart to be analyzed, the chart should occupy 1/3 to 1/4 of the horizontal frame. Other charts can be mounted along with it.

Orientation.  The pattern should be oriented horizontally, i.e., in landscape orientation (it is slightly wider than high).

Photograph the chart using the sort of lighting described in Imatest Lab or How to test lenses, taking care to avoid glare. Save the image in any one of several high quality formats, but beware of JPEGs with high compression (low quality), which will show degraded quality, unless, of course, you are testing JPEG degradations.

Because resolution varies over the image for most cameras and lenses, the chart should not take up too much of the frame— in most cases its dimensions should be no more than about 1/3 of the corresponding image dimensions (height and width), i.e., the area of the random pattern should not exceed about 1/10 of the total chart area (except in very low resolution systems such as VGA, where  you need all the pixels you can get).

Running the program

Open Imatest, then click on Rescharts. The Rescharts window is described in the Rescharts page.

Multicharts read image file popup menu


Select a pattern to analyze
(in this case, Random ) by clicking on the appropriate entriy in the popup menu below Read image file or by clicking on Read image file if Random is displayed. The Read image file button and popup menu (shown on the right) are highlighted (yellow background) when Rescharts starts.

Select the image to read. If the pixel size is the same as the previous Random run, you'll be asked if you want to use the previous ROI, adjust the previous ROI, or crop anew. 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.

Cropping  The corners of the crop should be located at the left and rightmost positioning marks Random chart positioning mark. It doesn't have to be precise because it will be refined in the ROI fine adjustment window, shown below. The ROI fine adjustment window may be maximized to facilitate fine selection.

Star chart fine crop dialog box
ROI fine adjustment window showing the cropped Random image
Canon EOS-40D camera, 24-70mm f/2.8L lens set at 50mm,
f/5.6, ISO 100.

If Express mode is not selected, the input dialog box shown below appears. Some buttons such as SQF Options are inactive: they are holdovers from other modules reserved for future use. This dialog box can be at any time by pressing the Image settings & options button.

Random pattern input dialog box
Image settings & options dialog box

Settings

Calc segments is the number of segments in 2D frequency domain to analyze. 8, 12, and 24 are supported. 8 is the default. Derived from Star chart, where segments are calculated in the spatial domain, which may be more meaningful. may be dropped in the future.

Calc. radii is the number of radii on the circle used for the MTF calculations. 64 is sufficient in most cases. 32 is faster; 128 is slightly more accurate, but slower.

Enter or calculate gamma  Choose between Calculate gamma & linearize from chart patches or Enter gamma for linearization. If Calculate gamma... is selected, the 16 patch step chart to the right of the random pattern is used to determine the value of gamma for linearizing the chart, Gamma (below) is disabled, and the displayed value of gamma includes the indicator (chart).

Gamma is used to linearize the test chart when Enter gamma... (above) is selected. It can be measured by Stepchart, Colorcheck, or Multicharts. 0.5 is a typical value for color spaces intended for display at gamma = 2 2 (sRGB, Adobe RGB, etc.). If gamma is entered (rather than calculated), the displayed value of gamma includes the indicator (input).

Channel is R, G, B, or Y (luminance; the default).

Display options

MTF plots selects the x-axis scaling. If Cycles/inch, Cycles/mm, or any of the Cycles/angle settings are selected, the pixel spacing (um/pixel, pixels/inch, or pixels/mm) should be entered.

X-axis scaling for linear plots selects the maximum spatial frequency to be displayed in linear plots.

Secondary readout  allows up to two secondary redouts (MTFnn, MTFnnP, or MTF at a specified spatial frequency) to be displayed on the MTF plots. Details here.

Don't worry about getting all settings correct: You can always open this dialog box by clicking on More settings in the Rescharts window.

After you press OK, calculations are performed and the most recently-selected display appears.

Output

The Display box in the Rescharts window, shown below, allows you to select any of several displays. Display options are set in boxes that appear below Display. All displays except Exif data have a channel selection option (Red, Green, Blue, or Luminance (Y) (0.3R + 0.59G + 0.11B).

Display Description
MTF (linear frequency) MTF for up to 8 segments (in frequency domain) of the star. Linear frequency display.
MTF (log frequency) MTF for up to 8 segments of the star. Logarithmic frequency display.
EXIF data and linearization Show EXIF data if available as well as linearization curves (used to calculate gamma from the chart).
Signal & Noise PSD (linear f) Show Signal + Noise, Noise, and Signal (noise removed) Power Spectral Density.
Signal & Noise PSD (logarithmic f) Display MTF contours in a rectangular plot with linear or logarithmic frequency display. Similar to the MTFnn rectangular plot.
   
In addition to the displays, two buttons allow you to save results.
 Save screen Saves an image of the Starchart window as a PNG file. If you check Display screen in the Save screen dialog box, the image will be opened in the editor/viewer of your choice. (Irfanview works well, and it's free.)
 Save data Saves detailed results in a CSV file that can be opened by Excel and also in an XML file.

The spatial frequency is automatically calculated from the image, under the assumption that log frequency increases linearly with distance. The number of chart cycles is also determined automatically.

MTF

The MTF (Spatial Frequency Response, normalized to 1.0 at low spatial frequencies) can be displayed on a linear or logarithmic frequency scale. You can select between showing the first 8 segments equally weighted, or emphasizing any of the segments (Segment 1 is shown as a thick black line below). The average response is displayed as a thick magenta-gray line.

Star pattern MTF plot
MTF (linear frequency scale) for 8 segments of the Random pattern

The entire Rescharts window is shown. Gamma = 0.454 (chart) at the lower left of the plot indicates that gamma was calculated from the 16 patch grayscale just to the right of the random pattern. If it were entered into Star Charts, (input) would be displayed instead of (chart) following the value of gamma.

MTF50, MTF50P, MTF20, MTF20P, MTF10, and MTF10P for the first 8 segments are displayed in a table just below the plot.

This image has been simulated— it's not from a real camera. The important thing about it is that only linear, uniform signal processing has been applied— there has been no nonlinear processing, as is commonplace in consumer cameras. The processing consists of the Picture Window Pro Blur More operation followed by Unsharp Mask with Radius = 2 (no thresholds used for either operation). Because processing ls linear the slanted edge should give the same results as the random pattern, and indeed it does. In most cameras it would indicate a better MTF because more sharpening is applied near edges (even more for contrastier edges) and noise reduction is applied away from edges (throughout most of the random pattern.)

MTF from upper-right slanted-edge with Noise Reduction
MTF from Slanted-edge on upper-right:  verifies the random analysis
without Noise reduction (left), with Noise Reduction (right)

An interesting observation is that the random analysis appears to be more immune to noise than the slanted-edge measurement without Noise reduction, which has much better noise immunity than the Siemens star of Log frequency patterns. Modified-apodization noise reduction greatly improves noise immunity.

MTFnn displayed in rectangular coordinates (linear frequency)
MTF70 – MTF10: Rectangular (Cartesian)
coordinates, Linear frequency scale.

 

MTFnn, MTFnnP

 

The plot on the right shows MTF70 through MTF10 (spatial frequencies where MTF = 70,, 50, 30, 20, and 10%) on a linear frequency scale displayed in rectangular (Cartesian) coordinates. Frequency is displayed in cycles/pixel, but Line Widths per Picture Height (LW/PH), cycles/inch, cycles/mm, etc. can be selected by pressing the Image settings & options button. The full circle is shown: segment 9 corresponds to segment 1: (0 degrees center angle).

The legend (the box on the right) has been moved using the mouse to uncover the MTF10 (blue) line.

MTF displayed in polar coordinates
MTF70 – MTF10: Polar coordinates,
Linear frequency on radius.

 

 

The plot on the right shows MTF70 through MTF10 displayed in polar coordinates. Spatial frequency (cycles per pixel in this case) increases with radius. (This is the opposite of the image itself, where spatial frequency is inversely proportional to radius.)

A similar plot can be displayed in Star chart. The meaning of the angular variation is less clear here because it's derived from Fourier space.

MTFnn values from Log Frequency-Contrast
PSD (log-log scale) Signal + Noise,
Signal (noise removed),Noise (from blank areas) .

 

 

Power Spectral Density (PSD)

The plot on the right shows the Signal + Noise Power Spectral Density (the original measurement from the random area), MTF contours for each of the 8 segments. Spatial frequency is displayed on a linear scale, but a log scale may be selected and a color bar (see below) may be added.

This plot is primarily a check to verify that an appropriate amount of noise has been subtracted from the S+N signal so that a correct value of MTF is calculated and displayed (i.e., so that noise does not masquerade as signal— valid MTF response).

Equations and algorithm

The scale-invariant random pattern starts out as a uniformly-distributed random pattern (white noise) in spatial domain. It is Fourier transformed into 2-dimensional frequency domain, then transformed from cartesian (x,y) to polar coordinates (radius, angle). The amplitude is forced to 1/radius (PSD = 1/radius2); phase is unchanged. The signal is then transformed back into cartesian coordinates than spatial domain.



Subscribe to the Imatest Newsletter