Tomas Sobek Photography

Free high resolution images

Photogallery Photogallery
Panoramas Panoramas
Slideshows Slideshows
Articles Articles

Creating CIE file for ColorChecker Passport

13 October 2016

Motivation

Lately I tend to spend considerable amount of time trying to get the colours in my photos accurate. It is not unusual that I revisit my white balance temperature and green tint settings multiple times over a few days, until I am satisfied with the result.

Few months back I came across a video describing how to create a camera input profile with ColorChecker Passport Photo target, Darktable, and Argyll CMS. It seemed to have a potential to give me a better starting point for my photo processing. Unfortunately this video has a few issues:

  • It is a bit out of date, for Darktable 1.6.3 while today 2.0.6 is available. The interface has changed a bit.
  • The resulting profiles are not always well behaved. I am still not quite clear if this really necessary. But it's easy to achieve.
  • The author used a CIE file that comes with Argyll CMS. I discovered however that there are slight variations in the ColorChecker target pigments (specifically targets manufactured before or after November 2014). I am not quite sure where the Argyll file came from and how accurately it describes my own target.

I would like to address in this article the last point and show how to create CIE file from spectral data provided by X-Rite.

Available Data

You can read a lot about ColorChecker targets here. You can also download aggregated data of many measurements of these targets with spectrometers. While this may satisfy curiosity, I decided to go one step further.

Spectral Data From X-Rite

X-Rite provides with the target a proprietary program that can create colour profiles from DNG files. It can be installed even on a Linux machine using Wine. And when you look through the installation folder, you will find that they ship spectral file for the target:

C:\Program Files (x86)\X-Rite\ColorChecker Passport\win\Reference\
ColorChecker24_spectral.txt

When you open the file in any text editor you will be looking at 24 long lines of numbers:

Converting Spectral Data Into CIE File

I took CIE file that came with Argyll as a template. On my Mint system I found it in following location:

/usr/share/color/argyll/ref/ColorChecker.cie

When you open the file in a text editor, you will notice 3 sections: headers, format section, and actual data. Look at the format section:

NUMBER_OF_FIELDS 4
BEGIN_DATA_FORMAT
SAMPLE_ID LAB_L LAB_A LAB_B
END_DATA_FORMAT

You can see that the data that follows describes each colour patch with its Lab coordinates. We need to find a way to convert our spectral data into Lab. One way to do it is to use a Spectral Calculator Spreadsheet kindly provided by Bruce Lindbloom. The data in our spectral file seem to be measured with 10nm steps, so you need to download spreadsheet that corresponds to that.

To get Lab coordinates for a single patch, copy one line from your spectral file and transpose it. I simply replaced all instances of a tabulator character (\t) with new line (\n) in gedit. You should end up with 36 lines of text, each line with one number:

Then simply paste this text into the spreadsheet starting with value for 380nm wavelength (cell C14) and read the Lab coordinates for illuminant D on the right (cells M7~O7), click preview for larger picture:

We need to answer one last question: Which colour patch does this data belong to? It turns out that the rows of data in the spectral file correspond to colour patches in CIE file in following order: A1, B1, C1, D1, A2, B2, ... D6. Here is an example of a diagnostic file from Argyll's scanin to show the patch ids layout on the target:

For your reference, here is my resulting CIE file.

Scripted conversion

If you don't want to do manual steps I described above, you can achieve the same results with scripting. First I found following snippet in Argyll CMS documentation:

txt2ti3 ColorCheckerSG.txt ColorCheckerSG
spec2cie ColorCheckerSG.ti3 ColorCheckerSG.cie

But it turned out I would need spectral file in a different format for txt2ti3 to work correctly. So with Graeme Gill's help I wrote a little workaround script to do the conversion into TI3 format. It does following:

  • Multiplies all values by 100.
  • Gives each line appropriate SAMPLE_ID, i.e. A01, B01, C01, D01, A02, B02, ... D06.
  • Prepends and appends some extra text to make it a valid TI3 file.

You can download my script here. Once extracted from zip archive, give it execution permissions. Put it in one directory together with ColorChecker24_spectral.txt and run it. It should produce a new file ColorChecker24_spectral.ti3. Convert that file into CIE with:

spec2cie -n ColorChecker24_spectral.ti3 ColorChecker24.cie

If you get error messages, download latest Argyll CMS. I had issues with version 1.8.3 but version 1.9.1 worked fine.

For some reason the utility left in the CIE file some spectral information that confuses scanin. So I have simply deleted following lines from the resulting file:

DEVICE_CLASS "OUTPUT"
INSTRUMENT_TYPE_SPECTRAL "YES"
SPECTRAL_BANDS "36"
SPECTRAL_START_NM "380.0"
SPECTRAL_END_NM "730.0"
ORIGINATOR "Not specified"
DESCRIPTOR "Not specified"
CREATED "October 15, 2016"

Comparing resulting CIE files from both methods shows minimal differences. Please let me know if you notice any issue or inaccuracy in this article.

Creative Commons Licence
Article Creating CIE file for ColorChecker Passport by Tomas Sobek is licensed under a Creative Commons Attribution 4.0 International License.