I have an application where we take in a RAW file, apply some processing, and then output to a DNG via libtiff. I get almost all the information I need to generate the DNG file out of libraw fine, but I cannot find out where or how ColorMatrix1 is generated. It seems like cam_xyz is always ColorMatrix2, and rgb_cam is an interpolation of ColorMatrix1 and 2, but I don't know how to work my way to ColorMatrix1 for arbitrary input. Is this something that can be accomplished with libraw?
I'm having the same problem,
I'm having the same problem, Have you found any solution that you can share?
I just put the cam_xyz into
I just put the cam_xyz into ColorMatrix1 and set the illuminant1 to D65.
The DNG output color is slightly off but acceptable.
I'm not sure if libraw can do this. Take the PixelShift2DNG application as an example, that one is built around libraw but only supports a few cameras, the ColorMatrix1 field can be easily copied from Adobe DNG Converter results.
Well, that's one possible solution, convert the images using Adobe DNG Converter first, then you have it.
The real question
I think for me the real question is why libraw only uses one color matrix? Why not use two like DNG 1.5 and before or even three like DNG 1.6?
LibRaw's main goal is RAW
LibRaw's main goal is RAW data extraction (plus metadata needed for RAW processing).
RAW conversion is very basic and no plans to improve it (or even touch it).
Generally speaking, raw color data is also out of LibRaw's scope (unless contained in RAW metadata), although we provide some basic data enough for basic processing.
-- Alex Tutubalin @LibRaw LLC
Apart from what Alex said,
Apart from what Alex said, good colour can't be solved with a set of 3 by 3 matrices.