The automatic white balance algorithm of Raspberry Pi
The automatic white balance (AWB) algorithm on the Raspberry Pi (used in its camera modules) is part of the Picamera software stack and the libcamera framework (used in newer Raspberry Pi OS versions). Below is a detailed breakdown of how it works, its limitations, and ways to customize it. 1. How AWB Works on Raspberry Pi AWB in Picamera (Legacy) Algorithm : Uses a simple gray-world assumption (averages colors to neutral gray). Control : Adjusted via awb_mode in Python ( 'auto' , 'sunlight' , 'tungsten' , etc.). Limitations : Prone to errors in scenes with dominant colors (e.g., green grass skews balance). Less accurate than modern smartphone AWB. AWB in libcamera (New Default) Algorithm : More advanced, leveraging machine learning (trained on diverse scenes). Control : Configured via libcamera commands or rpicam-apps (e.g., --awb auto ). Modes : ...