Where to find the Adobe ColorMatrix

2

To manually apply the colour matrix for your camera you first need to find it. One way is to create a DNG (digital negative) file from ACR. If you then inspect it with a tool such as ExifToolGUI you are likely to find ColorMatrix1 and ColorMatrix2. The first is the matrix for a low colour temperature and the second is for a higher colour temperature such as D65. So use ColorMatrix2.

Alternatively, if DCRaw supports your camera you'll find the same matrix in the source code in the adobe_coeff class. It will look something like this:

{ "Canon EOS 600D", 0, 0x3510,

{ 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } },

The numbers are divided by 10000 to give the matrix (for the Canon 600D):

0.6461 -0.0907 -0.0882

-0.4300 1.2184 0.2378

-0.0819 0.1944 0.5931

This is identical to the Adobe ColorMatrix2.

The Adobe DNG specification can be found here: http://www.adobe.com/content/dam/Adobe/en/products/photoshop/pdfs/dng_spec_1.4.0.0.pdf

The spec explains that ColorMatrix2 is the matrix that goes from XYZ colour space (Google it if you want to know more about XYZ) to the Camera's RGB.

There is another standard matrix that goes from RGB to XYZ (see for instance http://www.easyrgb.com/index.php?X=MATH&H=02#text2)

This matrix is:

0.4124 0.3576 0.1805

0.2126 0.7152 0.0722

0.0193 0.1192 0.9505

Multiplying the first matrix by the second (in that order i.e. the first matrix pre-multiplies the second) gives a matrix that goes from standard RGB to the Camera's RGB for the 600D:

0.245467 0.155663 0.026238

0.086289 0.745977 0.236382

0.01900 0.180445 0.562994

So to go from the 600D CameraRGB to standard RGB we want the inverse of this matrix. This will be applied to our white balanced data. So we need to make sure that the matrix will not change the colour of white. This is done by scaling each row of the above matrix so each row sums to 1.0:

0.574368 0.364237 0.061395

0.080746 0.698056 0.221197

0.024921 0.236668 0.738411

Now we can invert the matrix giving us:

1.879574 -1.03263 0.153055

-0.21962 1.715146 -0.49553

0.006956 -0.51487 1.507914

Now, each pixel's rgb value must be multiplied by this matrix to get into the standard RGB colour space. So if the white balanced pixel has values r,g,b then the output values R,G,B are given by:

R = 1.879574*r - 1.03263*g + 0.153055*b

G = -0.21962*r + 1.715146*g - 0.49553*b

B = 0.006956*r - 0.51487*g + 1.507914*b

After this the tone curve is applied to each channel - typically with a gamma of 2.2 By default, DCRaw applies the BT.709 curve (Google it if you want to know more). It is not clear to me at the current time exactly what ACR applies.

There you have it. If you can follow matrix arithmetic then you can find the relevant matrix for your won camera and do the same thing.

Mark