3A Algorithm Introduction
The 3A algorithm library includes the AE, AWB, and AF algorithm libraries, but the AF algorithm library is not supported currently. The 3A algorithm library is registered with the ISP firmware to implement exposure, white balance, and color reproduction. For details about the API call sequence, see Overall Process.
Auto Exposure (AE)
The AE module obtains the current image exposure based on the automatic photometric system, and automatically sets the iris, sensor shutter, and gain to ensure optimal image quality.
The AE algorithm is classified into the following types:
- The iris-first policy adjusts the iris to a proper position first and then allocates the exposure time and gains. It applies only to the P-iris lens and balances the noise and depth of field.
- The shutter-first policy allocates the exposure time first and then the sensor gain and ISP gain. This minimizes the noise in the taken images.
- The gain-first algorithm allocates the sensor gain and ISP gain first and then the exposure time. This applies to the scenario of taking images of moving objects. You can also customize the exposure allocation policies of the AE algorithm. The following figure shows the workflow of the AE module.
The AE module consists of the AE statistics module of the ISP and AE algorithm that provides the AE control policy. The AE statistics module collects statistics on the luminance in the sensor input data. The statistics include histogram statistics and average values. The AE statistical module can provide the 1024-segment histogram of the entire image, average values of the four components R, Gr, Gb, and B, and average values of the four components for each region after the entire image is divided into M × N zones.
The AE algorithm principle is that the input image statistics are obtained in real time and compared with the target luminance. The sensor exposure time, gain, and lens iris are dynamically adjusted to ensure that the actual luminance is close to the target luminance. The following figure shows the working principle.
Automatic White Balance (AWB)
The spectral components of visible lights vary according to the color temperature. The white objects have a red cast at a low color temperature or have a blue cast at a high color temperature. Human eyes can identify the actual object color based on brain reflections. The AWB algorithm is used to reduce the impacts on the actual object color exerted by external illuminants. This ensures that the captured color information is converted into the information without color cast under an ideal illuminant.
The AWB module consists of the AWB statistics module and the AWB algorithm that controls the white balance policy.
The WB statistical module of the ISP determines whether each pixel output by the sensor meets the white point requirements specified by users, and calculates the average values of the R, G, and B channels for all the pixels that meet the requirements. It can collect statistics on the average R, G, and B values and number of white points for each region after the entire image is divided into M × N zones. It can also collect statistics on the average R, G, and B values and number of white points of the entire image.
Basic Concepts
- Exposure time: It is the period during which the sensor accumulates electric charges. It starts when the sensor pixel starts exposure and ends when the battery level is read.
- Exposure gain: It is the total amplification coefficient for the output electric charge of the sensor. The exposure gains include the digital gain and analog gain. Analog gain is preferred because it produces low noise.
- Iris: The iris changes the central hole size of the lens.
- Anti-flicker: The screen flickers when the power working frequency of the electric light does not match the sensor frame rate. Anti-flicker is implemented by specifying the exposure time and changing the sensor frame rate.
- Color temperature: It is defined based on the absolute black body. When the radiation of a light source is identical to the radiation of the absolute black body in the visible region, the temperature of the black body is the color temperature of the light source.
- White balance: The white objects have a blue or red cast at different color temperatures in sensors. The white balance algorithm is used to adjust the strength of R, G, and B channels to obtain the actual white color.