Relations between cam_xyz and rgb_cam


First of all, thanks for library. I have to say LibRaw is amazing.

I was confused when I tried to transform color space between camera color space, sRGB, and CIE XYZ.

I have read the documents from
It seems cam_xyz converts from camera color space to CIE XYZ, and rgb_cam converts from camera color space to sRGB.

I tested with Canon EOS 700D at hand. It shows cam_xyz as
0.660200 -0.084100 -0.093900
-0.447200 1.245800 0.224700
-0.097500 0.203900 0.614800
0.000000 0.000000 0.000000

and rgb_cam
1.886120 -1.041856 0.155736 0.000000
-0.217037 1.670174 -0.453136 0.000000
0.020000 -0.502375 1.482375 0.000000

Then I multiplied sRGB-CIE XYZ transform matrix (from, the one begins with 0.4124), and expected to get proportional cam_xyz or a transposed. But the result was not satisfying.
0.7039 0.0768 0.1697 0
0.2474 0.9366 -0.1839 0
0.0296 -0.2985 1.3577 0

Did I miss something? Thanks.


cam_xyz[] matrix is the same

cam_xyz[] matrix is the same matrix as DNG 'ColorMatrixN' (XYZ to Camera). For most cameras (ones without built-in color data) it is identical to Adobe's Color Matrix for Daylight.

rgb_cam[] is camera-to-sRGB conversion.

-- Alex Tutubalin @LibRaw LLC