White BalanceThat is, images of different colors in the real world can be correctly reproduced when shooting objects under different color temperature light sources.
Traditional manual white balance: Take a standard pure white object in the color temperature environment and analyze the data to obtain the average values of the three primary colors (R, G, B). According to the white definition: AVR (R) = AVR (g) = AVR (B). Changing the gain of R and B-sensing channels can achieve white balance.
Automatic white balance can be divided into the extensive hypothesis method and the prior knowledge method.
Automatic white balance based on gray world modelGeneral algorithms:
1. Select the White Balance statistical collection area based on the captured image, which can be a full image, a central area, or others. Different regions indicate different focuses;
2. Calculate the mean value of r B gr GB in the ROI Area;
3. obtain the maximum mean value as the standard reference value;
4. Divide the mean of the maximum value by the mean of r B gr GB to obtain the multiplication coefficient, for example, 1:
Figure 1
5. Use the obtained coefficient to correct the color and complete the white balance. The formula is as follows: 2:
Figure 2
The disadvantage of this method is that the color distortion is serious when the colors in the scene are not rich.
Automatic white balance based on prior knowledge
An automatic White Balance Algorithm Based on human skin color. In ycrcb space, the intensity of skin color ranges from Cr to [133 173] and CB to [77, 127]. The cr cb value of the human face in the dummy image falls within the skin color range, and the formula is omitted. The face detection algorithm uses the rapid face detection method proposed by Wang kongqiao and others, and its detection accuracy reaches 90.24%.
References:
[1] Hu Bo, Lin Qing, Chen guangmeng, and Zhang Liming. Automatic white balance based on prior knowledge [J]
[2] Gu Yuanbao, Fu Yuzhuo. An Automatic white balance method based on the gray world model