Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust White balance

I'm looking at some image processing algorithms for white balance manipulations. Seems like a previous Stackoverflow question answers the question of automatic white balance algorithms rather well.

However I'm wondering how to convert from one temperature to another, i.e. Making the assumption (and its a big assumption) that a white balance algorithm could take a processed image (e.g. JPEG etc) and place the overall temperature in a scene at 6500, how would you algorithmically "cool" or "warm" the scene to a specific temperature? This would be a common operation in an image editing program, albeit these typically operate on RAW images which have no processing applied (colour space manipulation or otherwise)- In the case of RAW files - perhaps the individual RAW files contain sufficient information (in the file header) regarding the colour calibration of the camera sensor to make the specific temperature transformation more deterministic?

Any input appreciated - thanks!

like image 336
trican Avatar asked May 19 '11 14:05

trican


2 Answers

If you work on RAW image, you can use Von Kries's proposition - and multiply by 3x3 diagonal gain matrix. In order to find these 3 numbers, you can photograph under some illumination an object which is "white" - like MacBeth ColorChecker If you can't do this, try to use some Automatic White Balance Algorithms.

Processing WB in JPEG is problematic since it is usually after non-linear function - Gamma. You need to apply inverse Gamma function, and only then you will be able to do white balance.

like image 68
Andrey Rubshtein Avatar answered Nov 15 '22 16:11

Andrey Rubshtein


The standard reference for this kind of question is the Charles Poynton Color FAQ, and this question is answered here: http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC20. Hopefully by reading other parts of the FAQ you will get an understanding of how to populate the matrix.

like image 32
Mark Ransom Avatar answered Nov 15 '22 17:11

Mark Ransom