Add new comment

Questions about color matrices in colordata

Hi,
I am trying to understand the behaviour/purpose of the various color conversion matrices that are present in the colordata struct. I was able to glean some information from the various forum posts dating back several years but I still have a bunch of clarifications. I am little new to raw processing and so I want to ensure that any erroneous results I am getting is not due to my misunderstanding of how the library returns these coefficients.

cam_xyz[4][3]
* This appears to be convert from XYZ colorspace to the camera colorspace (R G1 B G2). Does this do this conversion for the specific camera or for a reference camera? I noticed that DNG does AnalogBalance*CameraCalibrationN*CameraMatrixN to get this matrix. Is cam_xyz equivalent to this for DNG and for other formats?
* Do cam_xyz[1..4][] always correspond to the the channel order R G1 B G2?
* When you say cam_xyz has last all zeros on the last row for an RGB image, I am unclear on what that means. Is RGB image a Foveon image or does it mean for any Bayer CFA?

cam_mul[4]
* Are they the R G1 B G2 values that correspond to white as set by the camera?
* Is the order always R G1 B G2 irrespective of the layout?
* I noticed that WB_coeffs has coefficients for standard illuminants for some formats. So will XYZ = inv(cam_xyz)*WB_coeffs[21][...] corresponds to the XYZ for d65 white point?

pre_mul[4]
* Does this equal WB_coeffs[21][...] if set?

cmatrix[3][4]. Not clear what this really does? From the dimensions, it appears to operate on the linear color space of the camera. But not clear what it transforms it to.

rgb_cam[3][4]. Am I correct in assuming this converts the linear camera values R G1 B G2 into RGB in the sRGB colorspace?

ccm[3][4]. Not clear what this really is doing?

In general, for non-demosaiced image, each pixel only has one color component? So how exactly can I use a matrix such as rgb_cam?

Thanks for all your help in advance. libraw is really powerful but kinda hard to understand (atleast for me personally!).

Dinesh

Forums: