how to get XYZ colors?

Hi,
i try to convert the camera color space to some meaningful standard color space (XYZ whould be a good start,but some wide gamut RGB will do too), but there are really *A LOT* of matrices and factors in imgdata.color... cam_xyz looks promising,but it seems that this is for camera_colorspace = cam_xyz * xyz_color, so exactly the opposite transformation i need. cam_xyz is a 4x3 matrix,so not it is not invertable (is it?). I have no idea what cmatrix,pre_mul cam_mul,rgb_cam (which also looks very promising,is it sRGB with fixed d65 white point?) is exactly for,or how they relate to each other. pls clarify some of this. :-)

Forums: 

You can use cam_xyz matrix.

You can use cam_xyz matrix. it is 4x3 because bayer data contains 4 channels (in general).
For cameras with two identical green channels this matrix is actually 3x3 (last row is zeroes)

-- Alex Tutubalin @LibRaw LLC

Please develop furher

I'm in the very same step, chaining Cam_xyz with xyz_srgb matrixes, but can't get the color right... What am I missing? Also, which coeficients do I have to use to do white balance?

Thanks in advance.