HOW-TO: Camera Colour Calibration With QPcard 201 and Argyll Color Management System

This is a description on how to perform colour calibration of a camera and photo settings under Linux using the UFRaw raw format handler, the QPCard 201 calibration chart and Argyll Color Management System.

Color Calibration Examples
Color Calibration Examples
Figure 1: Color Calibration Examples.

After struggling with LPROF and failing to make it work for me (see this how-to), I've reworked my work flow for colour management to incorporate Argyll Color Management System instead. This had the positive side effect that I could make my own script that provides the fast and effortless production of a temporary profile for every photo session.

In a related how-to I described how to use the ICC profiles that come with Canon Digital SLR (EOS) together with UFRaw to digitally develop colour calibrated photographs. This how-to will describe how you can use the QPcard 201 and Argyll Color Management System to create your own ICC profile that describes the lighting conditions of a photo session. With modification this guide can be used to produce a profile from other charts as well, of course, such as the Gretag Mcbeth. This profile can then be used to further correct the colour of you pictures.

In figure 1 there is a photograph with the QPCard201 used to calibrate the colours. There is also a set of close-up images showing the results from using the custom profile from this how-to compared to some profiles that came with the camera. The general profiles required manual white balancing and exposure adjustments to get this close to the custom profile.

In my work flow I use

To put this together I used the following resources

See also:

Preparations

  1. Install UFRaw, Argyll and ImageMagick. I did this with APT since I run Ubuntu.
  2. Download the computer vision template for the QPCard201, qpcard201.cht and qpcard201.cie, and put them at a suitable place. Below I will assume they're under ~/cms/ . I used the CHT file suggested by Graeme Gill as an example, but his data didn't work for me. The data in the file are my own manually entered so hopefully this makes it a better general match. The CIE file, however, is Graemes.
  3. Download UFRaw settings suitable for generating the profile and using the profile, .ufrawrc.make_profile and .ufrawrc.use_profile, and put them in ~/ (since you already have your .ufrawrc file there).
  4. I have made myself a script that performs all the work flow steps below. You may need to modify it to fit your platform.

Work Flow

  1. Start you photo shoot by taking a picture of your colour chart. Make sure it's facing the camera straight on, because Argyll will only match rotation of the chart and not perspective.
  2. Convert your raw image file depicting the chart to PNG format using UFRaw and the "make_profile" configuration file. The configuration file sets 5000 K white balance and disables colour profiles for linear conversion. ufraw-batch --conf=$HOME/.ufrawrc.make_profile myimage.cr2 \ --out-type=png --output=/tmp/custom_profile.png
  3. Crop the image using your favourite image editor so that only the colour chart is visible with just a little margin around. The image has no profile so any editor will do.
  4. Convert the PNG file to TIFF. convert /tmp/custom_profile.png /tmp/custom_profile.tiff
  5. Use scanin to extract the colour values from the chart in the image. The following line works for me and gives a nice diagnostics image. scanin -dioa -G 3.0 /tmp/custom_profile.tiff \ $HOME/cms/qpcard201.cht \ $HOME/cms/qpcard201.cie
  6. Now check the diagnostic image (diag.tif) to make sure that the CV found the colour patches correctly. display diag.tif
  7. If everything went alright so far you're ready to generate a profile from the measure data extracted in the previous step using colprof colprof -ag -qu -b n -y /tmp/custom_profile
  8. Finally just clean up all temporary files. mv /tmp/custom_profile.icc /tmp/custom.icc rm /tmp/custom_profile.*
  9. Finally you may open your other raw images from the same photo shoot using UFRaw with the "use_profile" configuration file. ufraw --conf=$HOME/.ufrawrc.use_profile myimage.cr2