CarVac / librtprocess

A project to make RawTherapee's processing algorithms more readily available.
Other
53 stars 24 forks source link

how to get the best result from the API? white balance correction? #50

Closed JVision closed 4 years ago

JVision commented 4 years ago

Hi CarVac,

As you pointed early in another post, the best demosaicing result comes from white balanced data? How to achieve that using the API?

I found there is already an implementation of white balance application. However, the color (RGB) scales/coefficents needs to be known beforehand. What is the correct way to get the coeffcients?

Best JVision

CarVac commented 4 years ago

The white balance coefficients are obtained from EXIF data. For example, LibRaw's cam_mul gives the as-shot white balance coefficients.

https://www.libraw.org/docs/API-datastruct.html#libraw_colordata_t

JVision commented 4 years ago

Thank you for the prompt response. I'd like to keep my code to be short and concise. kind of reluctant to include another library such as Libraw. Is there a lightweight way to do so? or could you please tell me which EXIF tag specifies the values? I am reading the dng sdk 1.5 specifcation and suspect that AsShotNeutral is the default camera WB. am i right? Thanks again for your kind response.

CarVac commented 4 years ago

Looking at my Ricoh GR DNG files, I would venture to say that the "As Shot Neutral" is the reciprocal of the WB multipliers.

In my Canon 5D .CR2 files, it appears both in "WB RGGB Levels As Shot" and "WB RGGB Levels", but these are integers that you need to divide by the minimum of the four.

The reason to use a library for decoding raws is because all cameras do it differently...

JVision commented 4 years ago

Ok. problem solved. libraw is the way to go. appreciated!