Help with Creating DNG Spec Forwarding Matrix

4 weeks ago

Hello everyone,

I was hoping to get some guidance on creating DNG Spec Forwarding Matrices.

I've been trying to do this myself for a while now...

Frankly, in the end I just used Adobe DNG profile editor to make changes to the incumbent forward matrices (by making colour matrix adjustments) that I wanted.

But having spent so long trying to understand this, it's a little bit stuck in my head and I need closure!!

So here goes...

The Premise

I'd like to create forwarding matrices for use with the 'embedded' profile that my camera OEM includes with their cameras..

I'm a LR user. So in LR I get the choice of "Adobe Standard" and "embedded" under the camera calibration panel.

I've extracted each of these profiles.

The adobe one contains a lot of data (if you've read this far you probably know which data it is, I won't list it all out)

The embedded profile contains 2 color matrices and nothing else (bar "0" value DNG spec tags of course)

My Problem

I've read (and re-re-re-re-read!!) the adobe DNG spec document and I just can't get my head round what I need to do...

I'm lead to believe that the Forward Matrices can be calculated using the data found in the Colour Matrices

The maths for this seems fairly simple.... (just apparently not for me)

From Adobe:

First, invert the XYZtoCamera matrix.

CameraToXYZ = Inverse (XYZtoCamera)

Second, the white balanced transform is computed

CameraToXYZ_D50 = CA * CameraToXYZ

(CA is an equation found on Bruce Lindbloom's site)

I'm using excel to perform the maths...

(MINVERSE to inverse matrices and MMULT to multiple them)

My sticking point seems to be creating the correct XYZtoCamera matrix..

From the DNG spec

DNG 1.2.0.0 and later requires a specific interpolation algorithm: linear

interpolation using inverse correlated color temperature.

To find the interpolation weighting factor between the two tag sets, find the correlated color

temperature for the user-selected white balance and the two calibration illuminants. If the

white balance temperature is between two calibration illuminant temperatures, then invert all

the temperatures and use linear interpolation. Otherwise, use the closest calibration tag set.

My first hurdle appears to be finding the user selected WB.

My DNGs feature the tag 'AsShotNeutral'

eg

0.4459930314, 1, 0.8338762215

If I assume (...) this is an expanded XY value, then a CIE 1931 xy to CCT Calculator gives me 4419 Kelvin (FWIW, LR says 5000k so perhaps that's not so far off...)

(it's also possible that 'AsShotNeutral' values are the RAW multipliers)

So as I'm not sure, I'm trying to follow the DNG spec instruction for working with an unknown XY value

1. Guess an xy value. Use that guess to find the interpolation weighting factor between the color calibration tags2. Find a new xy value by computing:

XYZ = Inverse (XYZtoCamera) * CameraNeutral

(If the XYZtoCamera matrix is not square, then use the pseudo inverse.)

3. Convert the resulting XYZ to a new xy value.

4. Iterate until the xy values converge to a solution.

I'm very unsure about the requirement here..

I've read a few blog posts/sites on the subject and they seem to suggest plotting out points on a graph until the the xy values converge to a solution

I do wonder if the main problem I'm facing is that I'm reading a document that's basically aimed at software developers trying to write a .DCP from scratch, when in actual fact what I want to do is take an existing set of color matrices and calculate the associated forward matrices from them.

TLDR

I have two OEM .DCP colour matrices, one for each std illuminant (A and D65)

0.7571 -0.2249 -0.0223 -0.4171 1.3145 0.1062 -0.0357 0.1601 0.7591

0.6653 -0.1486 -0.0611 -0.4221 1.3303 0.0929 -0.0881 0.2416 0.7226

I also have a DNG tag 'AsShotNeutral'

0.4459930314 1 0.8338762215

How would I go about calculating DNG spec .DCP forward matrices based only on the above data?

Many thanks