ActionPhotos by Marianne

Home -> Tech Info -> Sensor Analysis -> Getting Started

What do I need?

All you need is your camera, a blank wall and suitable lighting to take RAW test images. Depending on your camera make and model, you may need to use a RAW converter to produce TIF files for analysis. After you have suitable files, they are easily analyzed by the Image Statistics software which runs on a PC.


What's a Test Image?

For basic sensor analysis, we do not need or want any image detail. Ideally, a test image is completely "flat field," that is, uniform white, gray or black with no variation across the image. In fact, these images may be taken without even having a lens on the camera. The exposure that you want to use will depend on the specific test being conducted; we will look at sensor saturation with completely washed-out white images, evaluate sensor capacity with light-toned images, and look at types of noise with very dark or completely black images.


What's a Good Subject?

You want a blank wall or any homogeneous surface lacking detail, over at least part of the image. You will want an area in your image that's at least 200 by 200 pixels, which is of uniform tone. Color test charts are often very useful, if photographed closely enough that each patch on the chart covers an area larger than 200x200. Take the test image without a lens, or with the lens defocused enough to hide any dust, dirt or surface imperfections; remember to use a wide aperture.


What Kind of Light Should I Use?

It is often important that the light source be steady, i.e., not exhibit any flickering. Halogen or other incandescent lights are fine, as are many Compact Fluorescents which have high-frequency electronic "ballasts." Daylight such as window light is very good, provided that the weather isn't causing brightness variations while you are taking a test-image set. Definitely Avoid: Fluorescent tubes or other gas-discharge lighting other than Compact Fluorescent, or electronic displays such as TV sets or monitors; also make sure that no lights of these types are shining on your test subject through a window or open door. Although it is possible to minimize the effects of lighting flicker by selecting suitable shutter speeds, we do not want any such restrictions on shutter speed for these tests.


What Software do I Need?

If you use a Nikon camera which can produce Uncompressed 14-bit RAW (.NEF) files, you will only need the Image Statistics (IS) application described below.

For other camera models, you will need to use the RAW converter dcraw which can produce the Document-mode TIF files required by the IS app. Version 9.16 copies of dcraw executables are included with the IS application archives linked below, or the latest version may be found here. Select the [dcraw.exe] link under "Latest dcraw builds." You may find other sources of dcraw executables by Googling "dcraw download."


What Kind of Computer can I Use?

The IS application is written to be run on a PC, from a Command Prompt window (it is a Console application). There are separate versions for 32-bit and 64-bit systems. The app is small and fast, and does not require a powerful computer to run.


How do I set up the IS app?

Download the zip file containing the two versions of the IS app here for 32-bit, or here for 64-bit. Open the archive and copy ISTTIF.EXE, ISTU14.EXE and DCRAW.EXE to any folder (directory) that is listed by the PATH command executed from a Command Prompt window. As suggested by their names, ISTTIF.EXE reads TIF files generated by dcraw and ISTU14.EXE reads Nikon 14-bit Uncompressed RAW files. Other than their names and the type of image file that they read, the two apps are used in exactly the same way.

In the archive you will also find a set of simple batch files, which make running the software more convenient, especially if you are processing a set of images, and/or if you need to run dcraw because your camera does not produce Uncompressed 14-bit NEF files. You should open these with a text editor and modify the filenames to match those used by your camera, and edit the drive letter, if necessary, to match the one assigned to your memory card reader. Then copy them into the same directory with ISTTIF.EXE and ISTU14.EXE.

The batch files are: TS.BAT for images requiring dcraw; US.BAT for Uncomp. 14-bit images; TA.BAT and UA.BAT as "master" batch files that run a full set of image pairs by calling the single-image batch files. The master batch files are written assuming that you start each file set in an empty folder, with the file-number sequence reset to 0001. If this is not the case, edit the master batch file so its file numbers match your actual image files.


How do I Run the IS app?

First, open a Command Prompt window. For a brief list of features and switches, type ISTTIF /? which will provide a reminder display of the program's usage.

Generally, the approach used in this guide is to use the batch files to analyze images which reside on a memory card connected to your computer via a card reader. This saves the step of copying all of the files to your computer, and the batch files only require you to type the 4-digit numeric portion of the image file names. For the batch files TS.BAT and US.BAT to work, you must first set the default directory for your card reader to the one that contains the image files of interest. For example, if your card reader is drive G: and the files you wish to analyze are in folder 102NC_D3, use the command CD G:\DCIM\102NC_D3.

Note that although the IS apps themselves allow switches to appear anywhere on the command line, the batch files assume that the file numbers will be placed first, with all switches following them.

What Does the IS app do?

With a suitable image in the current directory, typing the batch command TS file# or US file# will open the image file for read-only. By default, the program scans image data from the center 200x200 pixels of the image, then lists the basic image statistics - average and Standard Deviation (SD), maximum and minimum value - for each of the three primary color channels.

If you place two file numbers on the command line, the IS app will open both files, and use the difference between the two images for computing the SD. This is an important feature for certain kinds of measurements.


That's Boring. Does it do Anything Else?

That is all the information that you need from each test image, to determine the basic sensor characteristics! For convenience, and for more advanced analysis, there are a number of additional features, as listed below. Most of these features produce tabulations of data in CSV format, which can be directly imported into a spreadsheet for plotting, or for further computational analysis. Detailed examples are given in other sections of this guide.

The primary purpose of the IS app is to collect and condense image information into a form which can be plotted or analyzed further, using a spreadsheet application such as Excel. Depending on the type of analysis performed, output is appended to specific text files (.CSV files). Much of its power, speed and convenience becomes realized when running it from batch files, which can rapidly extract data from a large set of image files, or from many areas of a single image or image-pair.

Feature List

Automatic Histogram-derived Statistics: In the case of dark bias frames or black frames on certain cameras such as Nikon or Sony, there is data loss due to truncation of negative-valued noise contributions. These cases are automatically detected, and a supplemental statistical analysis is run, based on histograms around the channel average values. This approach quantifies the lost data and allows determination of the channel average and SD which would have been calculated, if the negative data had not been truncated. This greatly simplifies determination of some sensor characteristics, such as read noise and ADC offsets.

Clipping and Saturation Counts: As the image is being read, a count is kept for the green channels, of the number of sensor data values which are at 0, or near the full-scale saturation value. If either count exceeds a certain rate, a warning message is displayed which shows the rates. If the L switch is used, this information is included in the CSV file.

Switch-Enabled Features

Switch Syntax: Switches are a single character preceded by a hyphen or forward slash, for example -L or /L. Switches which take an optional parameter may also be typed as S=nnnn, for example W=400 sets the window width to 400 pixels; it is important not to place any embedded spaces into these switches. Switches may be placed anywhere on the command line, and are not case sensitive. In the event of any switches which conflict, the last one entered has priority.

Switch L: Directs basic statistics, along with filename and window settings, to file ISTTIF.CSV or ISTU14.CSV. All data is placed onto a single line, so that successive runs of the IS app will build up a listing that is easily pasted into a spreadsheet.

Window Control

Switch W: Sets window size in pixels, both width and height (height may be overridden by using the H switch). Default window size is 200x200 pixels.

Switch H: Sets window height in pixels. Does not affect window width setting. Default window height is equal to width.

Switch X: Sets X coordinate for upper-left corner of window. Without this switch, the window will be centered in the image. The entered value will be reduced if it causes the window to extend past the image right border.

Switch Y: Sets Y coordinate for upper-left corner of window. Without this switch, the window will be centered in the image. The entered value will be reduced if it causes the window to extend past the image lower border.

Image Data Extraction

Switch R: Compute average row data across the window, and output to file RCDN.CSV. This is useful for plotting of vertical banding, or if a window has only a single row, provides an image data contour which can be used for edge analysis or other purposes. Output is given for each of the four color channels (R, G1, B, G2) separately.

Switch C: Compute average column data across the window, and output to file RCDN.CSV. This is useful for plotting of horizontal banding, or if a window has only a single column, provides an image data contour which can be used for edge analysis or other purposes. Output is given for each of the four color channels (R, G1, B, G2) separately. Creative use of the R and C switches can allow sharpness and CA testing, such as performed by Imatest.

Histograms These have many applications, such as determination of sensor-data scaling, deviations from normality, and detection of in-camera processing such as hot-pixel suppression. Use of any one of the following histogram switches will enable histogram-data output to file HISTIF.CSV or HISTU14.CSV. Default histogram parameters are: Start=1, Bin width=1, N=50 (number of bins).

Histograms are book-ended, i.e., an extra bin is provided at each end of the histogram range, to show how many values there are below and above the selected histogram range. Output is given for each of the four color channels separately.

Switch N: Set number of bins for histogram. Default is 50 and maximum is 512.

Switch B: Set width of each bin. Default is 1. If the E switch is used, this setting will be ignored since the IS app will then calculate the required bin width.

Switch S: Set starting-bin value. Default is 1.

Switch E: Set ending-bin value. Default is S + (N-1)*B. If this switch is used, the default or user-entered bin width, B, will be overwritten.

Discrete Fourier Transform (DFT) of Average row and column

Switch F: Enables a two-step process which first computes the average row and column across the window (such as enabled by the R or C switches), then performs a 1-D Discrete Fourier Transform on both. This is a relatively fast process, and is intended for analysis of signals which are row- or column-aligned, such as banding or periodicities caused by multiple ADCs assigned cyclically to rows. Only enabled for window dimensions up to 2000x2000 pixels. Output is directed to file DFT.CSV. Takes an optional parameter, which limits the output to only the upper n frequencies. The advantage of using a DFT rather than FFT (Fast Fourier Transform) is that there is no restriction on window size.

Multi-row/column DFT

Switch M: Runs a 1-D DFT on every row and column. Output coefficients from this process are then averaged across rows, and across columns. This is highly computationally intensive and the user is advised to try this with modest window sizes first. Intended for frequency analysis of signals which are not aligned to sensor rows or columns. Maximum window size is 2000x2000 pixels. Output is directed to file DFT.CSV. Takes an optional parameter, which limits the output to only the upper n frequencies.

Autocorrelation

Switch A: Runs Autocorrelation on every row and column, and outputs the averaged row and column results to file DFT.CSV. This is highly computationally intensive and the user is advised to try this with modest window sizes first. Maximum window size is 2000x2000 pixels. Autocorrelation is used for detection of subtle patterns which can be obscured by noise, and is sensitive to certain in-camera image processing such as Nikon's hot-pixel suppression. It is also useful as a learning tool regarding phase-detect AF capabilities, as such AF systems rely on correlation algorithms to determine focus corrections.

This particular implementation of Autocorrelation assumes that the signal or image is periodic at the selected window width/height. Scaling is chosen so that the zero-shift base result will have a value of about 100.

Important Notes for Math Features

Note for F, M and A switches: These math functions operate on five color channels: R, G1, B and G2 separately, and also a combined Green channel, G1:G2. The purpose of adding the combined green channel is to double the sampling rate across the sensor, and include higher frequencies (or finer shifts for Autocorrelation).

Note for M and A switches: Use of these features will disable the Image Data Extraction, switches R or C, and the average-row/column DFT, switch F. The R and C switches will be redefined; use of the R switch with M or A will restrict analysis to rows only, and use of the C switch will restrict analysis to columns only. This saves processing time and output-file space, when only one type of output is desired.

 

Last Update:  Sep. 20, 2012.