XYZ of the camera primaries.

Hey Alex,

I know you are very brief in answering questions, but I'd love if you answer my questions. I'll make it bullet style and mark them in bold, so it's clear what my questions are.

First a bit of context: I want to know the XYZ coordinates of the camera primaries of the Bayer channels. I want to do this in a general way for both 3-component and 4-component color models. For now, I was using the cam_xyz matrix limited to the 3x3 submatrix in case of 3-component color data, and invert that to be able to convert Bayer primaries to XYZ. But that doesn't work for 4 components, as this matrix transforms the wrong direction for me.

  • What is the most portable way across cameras and color models to obtain the XYZ values of the Bayer primaries?
  • What is the use of the cam_xyz as this converts from XYZ to camera, and not the other way around? When is this useful?
  • I have seen rgb_cam converts from camera to sRGB. If I use this, followed by converting this sRGB to XYZ, I'm where I want. However: I have seen you mentioned a couple of times here on the forum that cam_xyz_coeff produces rgb_cam. So I'm wondering: Where does this 3x4 matrix come from?

Many thanks!


I'm not excellent in color

I'm not excellent in color theory, but in general:

- camera responds to any visible spectrum signal
- and, also, on UV and IR wavelenghts too.

So, triangle angles (bayer primaries) may reside outside of 'human eye locus' on xy 'visible colors' diagram (to include as much as possible colors into triangle).

The values you calculate from camera color profile data to be derived from profile creator's intention (color gamut, etc), not real 'bayer primaries'.

-- Alex Tutubalin

I think I figured it out.

I think I figured it out: it makes physically more sense to express the XYZ primaries in terms of the primaries of the CFA. The best you can then do in the colors from the CFA to XYZ, is to minimize the error made. This is what is implemented in the pseudoinverse() function, as described here:

This is done by minimizing the squared error of an overconditioned system of equations.

CFA does not define the

CFA does not define the response. The product of CFA transmission spectra, silicon response, and in-camera raw data processing does. pinv is a very useful tool if you need just a matrix. or going to overload a matrix with curves. Conversion from camera RGB to XYZ is not useful however. There is no need in intermediate steps.

Iliah Borg