How does AWB work?

Posted:
in General Discussion edited January 2014
Hi, I'm just wondering if anyone can describe the algorithm that Auto White Balancing uses and in which situations are it fooled? All red objects? All green objects? All blue objects?



For example, we know that auto exposure works by trying to set the overall image to an average of 18% grey. This works most of the time as many things around us average 18% grey. However, it is fooled by all white objects - when it tries to expose white to 18% grey, the result is an underexposed image. Similarly, blacks get overexposed.



I understand that it is best to always use manual white balancing using a white/grey card or coffee filter or pringle lid, etc. Or if we can't do that, at least use the presets like sunny, flash, tungsten, etc. But, I'm just trying to understand how does the AWB algorithm work.



I can't seem to Google it anywhere. All the references I found just says that AWB these days are fairly good, but doesn't really explain how it works and especially when it fails and why... Also, is there any difference in AWB in-camera and similar auto color functions in programs such as iPhoto or Photoshop? Thanks!

Comments

  • Reply 1 of 6
    I'm sure I could tell you if I knew what AWB was. That is, most image processing operations draw from a fairly small pool of mathematic tools.



    My best guess is that this is similar to histogram equalization. The processor tries to spread out color data to stretch across all of its gamut, or at least a larger portion of it. There are several linear and non-linear techniques to do this. I'll see what I can dig up in specific regard to AWB.
  • Reply 2 of 6
    Thanks for trying. Any luck finding more information?



    I'm wondering because sometimes iPhoto/Photoshop auto enhance or auto color functions can significantly improve the quality of photos with strong color casts in them. Other times, it just makes it look worse!



    I tried this on a many different photos but cannot seem to find a trend to guess how the algorithm works...



    The histogram equalization as you've suggested imply that the majority of images are neautral in color on average (ie, gray). So, a closeup photo of a red flower will be (incorrectly) auto corrected to a greyish tone, but that does not happen! Someone please help!



    Again, I'd just repeat that I know that it is best to do it right in camera, but some of the photos I have are taken by family and friends with their own cameras and are not my own!
  • Reply 3 of 6
    Quote:

    Originally posted by drumsticks



    The histogram equalization as you've suggested imply that the majority of images are neautral in color on average (ie, gray). So, a closeup photo of a red flower will be (incorrectly) auto corrected to a greyish tone, but that does not happen! Someone please help!





    Red

    Green

    Blue



    Three colors. Three bytes. Three histograms.



    Auto Color operates in each of these histograms. Auto Levels converts the color-space to HSB (I think) and operates on Brightness only. Often, they produce similar results. Without going into too much detail, non-linear equalization methods have two goals: 1. spread the values in the image across as much of the range as possible, 2. maintain statistical distribution. These two criteria are not complimentary, though they are not opposing crteria either.
  • Reply 4 of 6
    Quote:

    Originally posted by Splinemodel

    Three colors. Three bytes. Three histograms.



    OK. I can see that, but that still doesn't quite explain how does AWB (in theory) removes colorcasts...
  • Reply 5 of 6
    placeboplacebo Posts: 5,767member
    Quote:

    Originally posted by drumsticks

    Hi, I'm just wondering if anyone can describe the algorithm that Auto White Balancing uses and in which situations are it fooled? All red objects? All green objects? All blue objects?



    For example, we know that auto exposure works by trying to set the overall image to an average of 18% grey. This works most of the time as many things around us average 18% grey. However, it is fooled by all white objects - when it tries to expose white to 18% grey, the result is an underexposed image. Similarly, blacks get overexposed.



    I understand that it is best to always use manual white balancing using a white/grey card or coffee filter or pringle lid, etc. Or if we can't do that, at least use the presets like sunny, flash, tungsten, etc. But, I'm just trying to understand how does the AWB algorithm work.



    I can't seem to Google it anywhere. All the references I found just says that AWB these days are fairly good, but doesn't really explain how it works and especially when it fails and why... Also, is there any difference in AWB in-camera and similar auto color functions in programs such as iPhoto or Photoshop? Thanks!




    Magic.
  • Reply 6 of 6
    Quote:

    Originally posted by drumsticks

    OK. I can see that, but that still doesn't quite explain how does AWB (in theory) removes colorcasts...



    Colorcasts are formed when there's a narrow range of intensities for a narrow range of hues, if I'm thinking about the same thing. The histogram equalization will always spread out these statistical peaks, and the colorcasts will go away.



    But I must admit that I've never really used the term "Automatic White Balancing." This is probably because I generally work a lower level than the application level. So there might be a little twist to it.



    I promise, though, that I will have a complete answer for you by the end of the weekend. You have made me curious about this, and I think the carpeting is back down in my house as of today. (Hurricane damage). If I move back into the house, I will have easy access to my bookshelf of dorkology, which includes a bunch of image processing books and journals.
Sign In or Register to comment.