If I set black color as a sample in the custom white balance and then take a picture.The picture has a shade of green color. could you please tell me why?
4 Answers
The black you used was very likely not truly neutral but had a warm tint tending towards magenta, in which case green would be its complement.
White balance gets corrected by adjusting the relative intensities of red, green, and blue. The ratios are detected in the sample you provide, and the inverse is multiplied to each pixel to even things out. A proper white balance depends on the accuracy of these ratios.
It's hard to get accurate ratios when you measure near black, because a difference of +/- 1 in any of the values can make a huge difference to the ratio. The difference between 1/2 and 1/3 is .1667, while the difference between 127/128 and 127/129 is only .0077.
This means that the brighter your white balance target is the better, but only to a point. If any of the red, green, or blue components hits the rails and maxes out, the numbers will be off and the ratios will be inaccurate again. The best target for white balance is a light gray.
Because black has red, green and blue channel values near zero.
The white balance takes relative values of the color channels as a reference. For black a little higher noise in one channel drastically distorts the relationships. Example for black: red = 0, green = 1, green/red = 1/0 = infinity. So the relationship between red and green is not defined. Example for gray: red = 128, green = 120, green/red = 0.94 (well defined value).
-
2Even when the ratio is defined, it is not as exact when the numbers are small. The difference between 1/2 and 1/3 is much greater than the difference between 120/128 and 120/129. Jan 11, 2018 at 19:52
-
1@MarkRansom You're correct. What you say probably belongs in an answer, not a comment. Jan 12, 2018 at 5:51
What you stumbled upon is called UniWB (see https://photo.stackexchange.com/a/2421/32110) and can be used to judge exposure in the luminance histogram more accurately. (when shooting Raw, the WB is only influencing the preview image anyway)
Basically, by taking a black picture as custom WB, the weights for all three colour channels are set to 1.0. Since a typical Bayer pattern contains 2 green pixels (since our eyes are most sensitive to green as well), this results is a green cast in the image.
-
i should like to know the reason for the downvote? this is exactly how i experimented with uniwb when i read the article from guillermo lujik.– thsJan 11, 2018 at 7:22
-
The procedure from the question is not how you set UniWB, so this answer doesn't seem relevant even if the effect is coincidentally similar. But it wasn't my downvote. Jan 11, 2018 at 21:17
-
Basically, this answer may turn out to be right. In the low light conditions when the variance of the WB image is too high (and black image is pure noise!), the firmware may fall back to use UniWB.– ThinkeyeJan 11, 2018 at 21:42
-
it doesn't fall back, and it isn't coincidence. setting custom wb sets the factors so that the reference image is a neutral grey. if you have an image with all 0,0,0 the factors will all be 1, just like when you have 255,255,255. my answer explains why the images are green, like the querent wanted to know.– thsJan 11, 2018 at 22:13