Checking digital camera system linearity

When making custom digital camera profiles, it’s helpful to know if the system response is linear. For example, a two-fold increase in exposure time should result in a two-fold increase in linear device RGB. This can easily be tested by taking multiple different exposures of a test chart, a grey card, or even a piece of white paper.

The following procedure tests the complete system linearity, i.e. camera + lens + raw photo software. I have tested two Canon Digital SLR (DSLR) cameras using an X-Rite ColorChecker Digital SG (CCSG) target and Raw Therapee version 4.0.8 (RT). Other charts and raw photo software (e.g. dcraw, Darktable) can be used. The raw photo software must be able to output linear device RGB (UFraw does some weird scaling and is not suitable).

Photograph the target

I photographed the target as follows:

  1. Setup the test chart in a dimly lit environment, with a stable light source. I did this indoors during the day, with natural window light.
  2. Meter the correct exposure. I metered off an 18% grey card. Exposure is not critical, only the differences are used for the results.
  3. Shoot the grey card and set custom white balance (WB) in the camera. This step is optional: WB can also be set in raw processing.
  4. Shoot the target from about 5 stops under the metered exposure to about  5 stops over the metered exposure. Watch out for glare.

It’s best to shoot with low ISO, for minimal noise. You will need to use a tripod, mirror lock-up and a remote shutter release or a timed shutter release for long exposures. It is impossible to vary shutter speed by 10 stops and shoot everything hand-held: camera shutters are not fast enough in bright light and camera shake is a problem in low light.

Process the raw photos

Open each image in RT and load the neutral profile, which should switch off all adjustments. Then adjust the Color settings as follows:

  • Input Profile: No profile.
  • Working Profile: Irrelevant (no adjustments will be made in the working space and there is no Output Profile).
  • Output gamma: linear_g1.0 (this will disable the Output Profile).

If required, custom WB on a neutral patch and set the same custom WB for all photos. I did an Auto WB on my grey card photo and saved a temporary RT processing profile to make setting up the remaining images easier.

Some underexposed shots will be almost black and impossible to read. These can be brightened by increasing the white point linear correction factor (Raw tab): 2x = +1 stop, 4x = +2 stops, 8x = +3 stops, 16x = +4 stops. When the white point linear correction factor is at maximum, you might further increase brightness with exposure compensation (Exposure tab): 32x = 16 + 1 EV.

Almost done, crop each image to the target edges and export 16-bit uncompressed TIFF files.

8 stops of dynamic range with my Canon 400D. Each photo displays linear device RGB (gamma = 1).

Measure the camera response

I used Argyll CMS version 1.4.0 to read the patches of each TIFF file:
scanin -v -p -a -dipn filename.tif ColorCheckerSG.cht ColorCheckerSG.cie
-v Verbose output.
-p Perspective correction.
-a Recognize chart in normal orientation (not upside-down). This speeds up chart recognition.
-d ipn Generate diagnostic output. For checking the chart has been read correctly.
ColorCheckerSG.cht is the recognition template file from the Argyll CMS /ref folder.
ColorCheckerSG.cie was generated with spec2cie.

Always check the diag.tif diagnostic output to make sure patches have been identified correctly – this will save confusion later on. Argyll CMS will fail to read noisy and very dark images. For my cameras, photos more than 4 or 5 stops under-exposed had insufficient signal-to-noise.

Finally, I copied the scanin .ti3 text file outputs into a spreadsheet and plotted the RGB measurements for patches E5 (white), H5 (middle-grey) and E6 (black) versus exposure time in seconds. Use the exact exposure times reported by the camera. Some image viewers might report inaccurate exposure times because of rounding. And don’t forget to reverse any RGB scaling of under-exposed images that was applied in raw processing.

Behold, my Canon 350D and 400D DSLRs are linear over at least 9 stops!

Raw photo linear RED response of my Canon 400D for CCSG patches E5 (white, diamonds), H5 (middle grey, squares) and E6 (black, triangles). White-balance was made with a grey card (middle-grey). Grey diamonds, squares and triangles are clipped. Some minor variation is surely due to inaccuracies in camera shutter speed and exposure increments.

Raw photo linear GREEN response of my Canon 400D for CCSG patches E5 (white, diamonds), H5 (middle grey, squares) and E6 (black, triangles).

Raw photo linear BLUE response of my Canon 400D for CCSG patches E5 (white, diamonds), H5 (middle grey, squares) and E6 (black, triangles).

Raw photo linear RED response of my Canon 350D for CCSG patches E5 (white, diamonds), H5 (middle grey, squares) and E6 (black, triangles). These data were obtained at a different time of day, with more ambient light than the 400D data.

Raw photo linear BLUE response of my Canon 350D for CCSG patches E5 (white, diamonds), H5 (middle grey, squares) and E6 (black, triangles).

Raw photo linear GREEN response of my Canon 350D for CCSG patches E5 (white, diamonds), H5 (middle grey, squares) and E6 (black, triangles).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: