Author: Liu Xuhui colorant@163.com reprinted please indicate the source
Http://blog.csdn.net/colorant/
1.1 White Balance
1.1.1 color temperatureDefinition of color temperature: warm the black body from absolute zero. Each increase in temperature is called a 1-degree (expressed by the letter K). When the temperature rises to a certain extent, the black body then emits visible light, and its spectral composition and the feeling of giving rise to the temperature change accordingly. Therefore, the temperature of a certain color light emitted from the black body is set to the color temperature of the same color light source. Common color temperature: color temperature of the light source (k) tungsten lamps (incandescent) 2500-3200 K carbon rod lamps 4000-5500 K fluorescent lamps (fluorescent lamps, energy-saving lamps) 4500-6500k xenon lamps 5600 k carbon lamps 5500 ~ 6500 K daylight average 5400 K daylight in cloud weather 6500-7000 K cloudy daylight 12000-18000 K with the rise of color temperature, the color of the light source from warm to cold, the energy distribution in the light source is also shifted from the red light end to the blue light end. It is worth noting that the spectral distribution of the actual light source is different, while the color temperature only represents the degree of energy, does not reflect the specific spectral distribution, so even if the color temperature of the light source is the same, it may also cause different color reactions. Human eyes and brain have certain physiological and psychological adaptability to the color temperature, so the color we see is less affected by the color temperature offset, while the sersor of camera does not have this ability, therefore, if the image is not processed by the white balance, it is significantly different from the color displayed by the human eye (although the actual color displayed by the human eye is different from that under the white light ). The reason why the color temperature of sunlight changes with the weather and time is related to the refractive index of light of different frequencies: Long Wave light, small refractive index, strong transmission ability, Short Wavelength Light, large refractive index, it is easy to be scattered and has a low refractive index, which is why the traffic lights are red, fog lights are usually yellow, and the sky is blue. By knowing this, we can understand and analyze the laws and causes of the change in the color temperature of sunlight, and leave it to everyone to think about.
1.1.1 color correction when the color temperature changesTherefore, theoretically, we can see that with the increase of the color temperature, the color temperature must be positive. Otherwise, the color displayed by the object in such a light condition will deviate from its normal color, therefore, it is necessary to reduce the sensor's red gain and increase the sersor's blue gain. At the same time, the overall brightness must be kept roughly unchanged to some extent when adjusting the parameters. That is, when YUV is used to measure the brightness, the Y value should remain unchanged, theoretically, we can determine the proportional relationship between rgain and bgain by referring to the contribution of RGB-> YUV to the Y value. However, the actual situation is more complicated than this. Considering the cross effect and non-linearity of R and B photosensitive by different sensor, the best value may be slightly different from the theoretical value.
1.1.2 principle of automatic White Balance
1.1.2.1 principlesAutomatic white balance falls within a specific range based on the average color of the scenario. If the measurement result deviates from this range, adjust the corresponding parameter and correct until the average value falls into the specified range. The processing process may be based on YUV space or RGB space. For sensor, the common processing method is to correct the R/B gain so that the UV value falls within a specified range. In this way, automatic white balance is achieved.
1.1.2.2 handling of special circumstancesIn the automatic white balance, it is easy to encounter the problem that if the shooting scene is excluded from the color temperature of the light, the color itself deviates from the average color value, for example, if a large area is biased towards a certain color pattern, such as grass, red flag, and blue sky, force the white balance to adjust the average color near the gray color, and the image color will be seriously distorted. Therefore, the common practice is to set the color range of a source image in addition to the expected color range of the target result when processing the automatic white balance, if the average color of an unprocessed image exceeds this threshold, automatic white balance will not be performed. This ensures the correct handling of the above special circumstances. It can be seen that the determination of these two thresholds plays a key role in the effect of Automatic white balance.
1.1.3 example of a platformEnglish code Chinese UI color temperature rgain, ggain, bgaincloud cloudy day 7500 K 0x1d4c, 0x00cd, 0x0085, 0x0080daylight daylight 6500 K 0x1964, 0x00a3, 0x0080, 0x0088incandescence white hot light 5000 K 0x1388, 0x00a5, 0x0080, 0x0088fluorescent Fluorescent Lamp 4400 K 0x1130, 0x0098, 0x0080, 0x00a8tungsten tungsten lamps 2800 K 0x0af0, 0x0080, 0x0081, 0x00a4: as the color temperature increases, the variation is basically in line with the theoretical analysis in the previous section. However, most of the parameters here have some deviations from the theoretical values. The color temperature parameter settings of the fluorescent lamp have a large deviation from the theoretical values, the actual results also show that the parameter settings of the fluorescent lamp make the photos taken in the home environment blue. After the parameters are modified, the real-time effect is significantly improved. (Check some more information and we can see that there are usually two kinds of fluorescent lights with a color temperature of 4000 and 5000 K. At present, I am exposed to mostly K)
1.1.4 debugging and VerificationThe adjustment of specific parameters should be carried out on the standard color card using various standard light sources with known color temperature in the light box environment, on the PC, the color deviation between the color and the RGB component of the standard color palette is measured by the color Extraction Tool, and the proportional relationship between the gain of each component is adjusted accordingly. In order to get more accurate results, the exposure gain settings should be relatively accurate before this correction.