White Balance Algorithm-color temperature curve
This article describes the algorithm process of white balance, which is suitable for those who want to know and learn about the white balance principle.
In general, professional images and algorithms are required to implement the AWB algorithm. This article attempts to use multiple graphs to lower the understanding threshold for beginners, let everyone understand the white balance algorithm process.
Those who are still looking down here must have understood the concept of color temperature, and know that if white is not processed by AWB, the high color temperature (such as cloudy days) will be blue, and the low color temperature will be yellow, such as the bedside lamp (why! Otz) (for example ).
The picture of the T-shirt below is very classic. How can we talk about it later? However, we can see that the picture is yellow and blue. Even so, it is already the result of AWB correction.
Therefore, for the goddess Bai fumei in front of the camera does not become Avatar and yellow face, then you need white balance to work.
The process is simple:
1. In each color temperature (2500 ~ 7500) take several White Paper photos. Suppose you take six photos... 7500), which can be called a color temperature photograph.
2. Correct the color temperature. Specifically, correct the R/G/B channel, convert the White Paper to white, and record the correction parameters of each channel.
In fact, only the R and B channels can be corrected. In this way, six groups of correction parameters (rgain and bgain) are obtained ).
3. James, who is doing his preliminary work, found that as long as he knows the color temperature of the current scene, he can just get started. In fact, that's the case.
Therefore, the core of the AWB algorithm is to determine whether the color temperature of an image is in the daytime, at night, indoors, outdoors, in the hot sun, in the sunset, or on the beach in the sunshine. or under the "warm" bedside lamp in the bedroom.
Six color temperature pictures and six correction parameters were taken before. but 6 is enough, of course not enough. interpolation can produce countless values. We connect the points into a line and get a magic curve ------ color temperature curve. it looks like this.
Three values (RG, BG, and color temperature) are mentioned above, which should be three-dimensional. it doesn't matter. Let's take another curve of RG and color temperature. So long as you know the color temperature, you will know RG, know RG, know BG, know RG, and BG. Yes!
Now, all our preliminary work has been completed and the AWB color temperature curve has been obtained. In the next step, as long as the current color temperature is calculated, the current correction parameters (rgain, bgain) can be obtained through the shunteng touch melon ), the white balance is finished. (Don't worry, of course it's not that simple)
The first part is here first. The next part describes the core of the AWB algorithm-computing the image color temperature.
The knowledge points involved include image segmentation, white area judgment, Division of different light sources based on the color temperature curve, and weighted average of different light sources to obtain the actual color temperature.