How to compute White Balance from cam_mul?

How do I get the White Balance in Kelvin from the values I got in cam_mul?


What I want to do is the give

What I want to do is to give user a Color temperature slider that needs to start with the color temp of the photo (say 5000K) and let him move in the range of say 2000-10000K.

So how do I compute this using the various data obtained in libraw_colordata_t? I thought cam_mul is a start?


In colour science CCT is

In colour science CCT is derived from xy. xy calculation depends on the colour transform, raw to XYZ. This transform is not one-to-one because raw data isn't colorimetric. Different companies use different colour transforms for the same camera model. Say, the camera and ACR report different CTs for the same shot.
Your best bet is to shoot a camera at each CT setting, compile a table of CTs vs. wb coeffs, and interpolate.

Iliah Borg