Hi
I would like to do white balance corrections with libRaw. It looks to me like there is built in functionality to use the rggb multipliers specified by the camera during the shot or use auto based on full frame or a rectangle.
I am trying to work out where to get the multipliers for other conditions. It seems like in my Canon CR2 raw files there is a list of multipliers for daylight, shade, tungsten, etc. Is there a way to extract these or directly use them with libRaw? If so is the method general (i.e. will it work for other file formats and camera models)?
From other forum posts it looks like there is not a straightforward way to convert from colour temperature and tint to rggb multipliers. Is this correct?
Thanks in advance
Phil
1st:
1st:
With LibRaw 0.18 (currently in Beta1, Beta2 to be published soon),
in-camera WB multipliers are extracted into
imgdata.color.WB_Coeffs[256][4];
and
imgdata.colr.WBCT_Coeffs[64][5];
This extraction is made for all RAWs with embedded color presets, not only Canons.
1st array (WB_Coeffs) is indexed with EXIF Colorsource, so to get, for example, D65 preset, you need to inspect WB_Coeffs[21] for non-zero values.
2nd array (WBCT_Coeffs) is filled from 0 to 63:
WBCT_Coeffs[i][0] is color temperature (from camera settings)
and
WBCT_Coeffs[i][1..4] are WB coeffs.
There is no automated procedure to copy these values into processing, so one needs to examine array data (or, simply, fill WB drop-down with these values), than copy needed WB Coeffs into
imgdata.params.user_mul[] to use on dcraw_process() stage.
So, processing sequence is
LibRaw::open_file();
LibRaw::unpack();
... examine WB_Coeffs/WBCT_Coeffs
.. copy needed into user_mul
LibRaw::dcraw_process();
(and, sure, you may call dcraw_process() multiple times without unpack() of same file)
2nd:
WB Coeffs to CCT and back is not very complex (look into Adobe DNG SDK sources for sample code), but results of this procedure depends on color profile and camera calibration data used.
So, calculated CCT/Tint will, most likely, not compatible with other programs (or, even, with in-camera WB setting by CCT).
-- Alex Tutubalin @LibRaw LLC
Thank-you Alex
Thank-you Alex
I have just loaded up an image and I see the WB_Coeffs array. Elements 1, 3, 4, 10, 11 and 14 are filled, which presumably correspond to the 6 options of my EOS 40D (daylight, cloudy, shade, tungsten, fluorescent, flash). That's everything I needed.
Thanks for the excellent info.
Phil