In image processing, white balance (WB) is a key technique for correcting color shifts in images. Its core goal is to ensure that white objects in an image appear true white under varying light sources, while also ensuring that other colors appear natural and accurate. The following is a detailed explanation:
1. Why is white balance necessary?
Differences in light source color temperature: Different light sources (such as sunlight, incandescent light, fluorescent light, and LED light) have varying color temperatures, which can cause image color shifts. For example:
Warm light (low color temperature, such as candlelight) produces an overall yellowish/orange tint in the image.
Cold light (high color temperature, such as a cloudy day) produces an overall bluish tint in the image.
Differences between the human eye and a camera: The human eye automatically adapts to changes in light source, but camera sensors faithfully record the color of light, resulting in color distortion in uncorrected images.
2. How white balance works
White balance compensates for color temperature shifts in the light source by adjusting the gain of the red (R), green (G), and blue (B) channels in the image, restoring the neutrality of white objects in the image (R=G=B). The specific steps include:
Estimating the light source color temperature: Identifying the current light source type (e.g., daylight, shade, tungsten light, etc.) through algorithms or manual settings.
Adjusting color channels: Increasing or decreasing the brightness of corresponding channels based on the direction of color temperature shift. For example:
Under warm light (yellowish), increase the blue channel gain and decrease the red channel gain.
Under cool light (bluish), increase the red channel gain and decrease the blue channel gain.
3. Common White Balance Methods
Auto White Balance (AWB):
The camera or software automatically calculates adjustment parameters by analyzing grayscale areas in the image (e.g., a hypothetical white object).
Advantages: Convenient and suitable for most scenes.
Disadvantages: May fail in complex lighting conditions or when a neutral color reference is lacking.
Preset White Balance Modes:
Preset parameters based on common light sources (e.g., daylight, cloudy, tungsten light, fluorescent light, etc.).
Users can manually select a mode based on the scene.
Manual White Balance (Custom White Balance):
Use a gray card or white object as a reference and let the camera record its color and generate correction parameters during the shot. Suitable for professional photography or extreme lighting conditions.
Post-production Adjustment:
Manually adjust the temperature and tint sliders using image processing software (such as Photoshop or Lightroom).
4. Applications of White Balance
Photography and Videography: Ensure the faithfulness of colors in human skin tones, natural landscapes, and other areas.
Computer Vision: Prevent color shift from affecting algorithm performance in tasks such as object detection and image classification.
Medical Imaging: Correct the color of images from endoscopes, microscopes, and other equipment to improve diagnostic accuracy.
5. Example Results
Uncorrected Image: Shot indoors under tungsten lighting, the image has a yellowish cast, with the white wall appearing orange.
Corrected Image: White balance adjustment restores the wall to a white color, resulting in a natural overall color.
Summary
White balance is a core technique in image processing that eliminates the effects of light source color temperature and restores true colors. Whether achieved through in-camera functionality or post-production software, proper use of white balance can significantly improve image quality, avoiding visual discomfort or misinterpretation caused by color casts.