Thursday 8 February 2018

color correction - What is the math behind white-balance, and how to choose it?


Given a bad balanced RGB image (in terms of white balance), how can I choose the proper color balance that needs to be applyed (as a RGB vector where 128,128,128 is the neutral)?


Same question for a YUV image.



Answer



If you have a known white or grey point, you want to calculate the ratio between the colors so that each is given a factor to multiply by. For example, in your 250,245,255 reference it would be 1.02, 1.0625, 1 since multiplying the sampled values for white would produce an actual white. (255,255,255). Since the sensor should be linearly responsive, this same ratio should be consistent for the entire light range.


The exact math may vary a bit though depending on what type of entry your camera takes, but the principal is generally the same that you are trying to adjust the color channel's values by a factor to reach the corrected value.


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...