The myth of Automatic White balance, AWB
With the digital camera came the ability to set white balance, something that in the past was managed in the laboratory when printing, after the photographer, hopefully, had chosen the right type of film for the lighting and, also hopefully, also had corrected any deviance by filtration.
Now there is a little problem when the camera is told to automatically set white balance. There are several possibilities, none of which is certain to give a correct result. Purportedly, the camera shall set White Balance to the light source. However the optical element that takes in light is directed at the scene and will not see the light source. There is no way it can assess the light source; hence it is bound to rely on guesswork.
One of the methods that is implemented in the firmware in many cameras, is to analyse the scene and set white balance by tweaking RGB channels. The problem with this approach is that it does not relate to the lighting of the subject, but the light reflected from the subject. When using this method, there will be a magenta cast in mainly green subjects and a blue cast in mainly yellow ones etc.
So another approach, also used by camera manufacturers is to choose between the fixed settings in the camera, where there's sunlight. cloudy, open shade, incandescent, flash and fluorescent to choose from. Hopefully the camera may hit the right one and the image may come out with correct white balance.
Which one of all possible methods that the camera manufacturer has implemented is hidden to the user.
I'll illustrate with a few images, taken with a simple compact camera at Auto, so all the pictures are a bit under-exposed, due to mainly rather bright subject, but nevertheless, they illustrate the concept. The lighting in all cases is diffuse light from an overcast sky through the window.
First an image taken in my kitchen, where the walls are yellow. The image has a blue cas due to AWB:
Then an image taken in my room, which has blue walls, which render a yellow cast due to AWB:
Then again in the kitchen, but now with white balance set to sunlight:
And lastly, my blue room but white balance set to sunlight:
There are of course other algorithms than those used by this camera, and this one also offers another approach, also automatic, so you won't know which one it will choose. When the light is strong, it uses daylight setting when set to AWB. It is however evident that the camera will not know what's in front of it, and any guess might be wrong. Setting to one of the presets is likely to give a more consistent and better result than AWB.