[argyllcms] Camera matrix and LUT

  • From: David Bourgeois <david@xxxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Sat, 19 Dec 2015 01:31:44 +0100


I’m new to ArgyllCMS and I would like to use it to calibrate the matrix and
lut of a basic camera processing pipeline I’m studying. The idea would be
to profile it against a reference camera and not necessarily against the
true CIE values of the chart. It’s a small industrial camera I would like
to use for broadcast, so it needs to match the other cameras, not the chart.
So what I’m looking for is probably more like a device link profile but
I’ve difficulties to understand correctly how to do it.
I only have the 24 patches Colorchecker for now, but my purpose is to get
the maths right at this point.


I start with an RGB tiff file which comes from a raw -> gain+offset ->
demosaic, so it’s already balanced (white/black) and exposed properly. It’s
in linear space though with the camera raw “color space”, no color
corrections applied so far.

The basic pipeline is like the first line, but later I would like to
compare different variations like having the matrix before or after the
LUT+Gamma, using a 3D LUT or not:

1: [RGB_LIN] -> 3x3 matrix -> 1D lut -> Rec.709 gamma -> [RGB_709]

2: [RGB_LIN] -> Rec.709 gamma -> 1D lut -> 3x3 matrix -> [RGB_709]

3: [RGB_LIN] -> Rec.709 gamma -> 1D lut -> 3D LUT -> [RGB_709]

4: [RGB_LIN] -> Rec.709 gamma -> 1D lut -> 3x3 matrix -> 3D LUT
-> [RGB_709]

Here’s what I did so far to get the matrix only in the first pipeline


Creating the ti3

scanin -v -a -G 1 CAM_RGB_LIN.tif ColorChecker.cht ColorChecker.cie


Profiling with matrix only

colprof -v -D"CAM_RGB_LIN" -qm -am -u CAM_RGB_LIN

This profile gives me the matrix for the PCS, right?

To check, I applied the profile to the tif file to get the Rec.709
output and this does work correctly I think, both color correction and
gamma are applied.

cctiff -v CAM_RGB_LIN.icc Rec709.icm CAM_RGB_LIN.tif CAM_RGB_709.tif


If I want to get the 3x3 matrix value for my first pipeline, which is
LIN->LIN, I suppose I should create a device link profile towards a Rec.709
profile that would have the invert gamma applied, correct? I tried to
create such a profile with “synthetic ICC” from dispcalGUI, loading the
Rec709 profile and changing gamma to 1, saved as REC709_LIN.icc.

collink -v CAM_RGB_LIN.icc Rec709_LIN.icc MATRIX_LIN.icc
cctiff -v MATRIX_LIN.icc CAM_RGB_LIN.tif CAM_RGB_709_LIN.tif

The check gives me a tif image with colors but still in linear space, so
that sounds right.

The problem is that the resulting device link profile is now a CLUT and
not a matrix. Is there any way to generate a device link matrix only
profile? Or is there any other way to get this matrix?

Looking further at the 1D lut + matrix, I can make the profile but the
problem will be the same, how to get this as a device link ? Also is there
any way to do matrix then LUT in that order?

colprof -v -D"CAM_RGB_LIN" -qm -as -u CAM_RGB_LIN2


Also I was looking to get the peak and average error before applying the
profile so when comparing different cameras, I would know how far I start
from. Is it possible?

If I have a rec.709 tif file of the ColorChecker target from a reference
camera, how could I use this file to calibrate against it instead of the
ColorChecker.cie reference? Can I use spec2cie with D65 illuminant to
generate a cie file of the chart from the reference camera?

Sorry for all the questions, I know it’s a bit off the standard intent of

Thank you,
David Bourgeois

Other related posts:

  • » [argyllcms] Camera matrix and LUT - David Bourgeois