Camera module - automatic exposure
September 14, 2023
1. Definition of automatic exposure
First, we need to introduce exposure: the intensity of light multiplied by the time the light acts on. The "light intensity" in the definition refers to the intensity of light irradiation of the Sensor, that is, the illuminance; the "time on which the light acts" in the definition refers to the time the photosensitive film is irradiated by light, that is, the exposure time. Exposure is expressed in E, and the calculation unit is lux seconds. To obtain a certain amount of exposure, the greater the light intensity, the shorter the exposure time; the smaller the light intensity, the longer the exposure time. Exposure is one of the most basic and important techniques for taking pictures.
The picture below shows the same night scene taken from 1.3 seconds to 15 seconds. If the time is too short, it is called underexposure, and if the time is too long, it is called overexposure. However, exposure time is only one of the factors that affects exposure intensity, which will be mentioned later. Early exposure times required manual setting, and professional photographers usually used a light meter to calculate the required exposure intensity for the current scene.
Exposure intensity = exposure time * aperture size * ISO. The aperture on the mobile phone is fixed, so you only need to consider the exposure time and ISO (which is a representation of Gain value. Gain here is divided into Analog Gain, Digital Gain and ISP Gain, the details will not be elaborated. Readers only need to know that ISO refers to the signal gain). The automatic exposure on the mobile phone allows the camera to automatically configure the exposure size based on the current image information, that is, the exposure time and ISO value. The selection of the two will be described in detail later.
2. 18% gray
Let’s first introduce Weber’s law: that is, the difference threshold of sensation changes with the change of the original stimulus amount, and it shows a certain regularity. It is expressed by a formula, which is △Φ/Φ=C, where Φ is the original stimulus amount, and △ Φ is the difference threshold at this time, and C is a constant, also known as the Weber rate.
It's a bit roundabout, but the vernacular is that people's perception of natural stimuli is non-linear. The stimulus increases at a certain proportion, which is a uniform increase for people.
Let’s introduce the exposure partitioning system. This was explained by Ansel Adams and Fred Archer around 1940. As shown in the figure below, the human eye divides the gradual change from black to white into 11 levels, and the block V in the middle is considered to be a moderate exposure intensity, which is called For medium gray. The light reflectance of the V block is 18%, which is the defined 18% gray.
Therefore, photographers usually use a light meter to judge the ambient light to determine the exposure intensity of the photo, so that the overall exposure intensity of the photo is around 18% gray. But the scenes are diverse, so the "New York School of Photography Photography Textbook" also teaches everyone not to blindly trust the value of the light meter to adjust the exposure parameters. For example, in a snow scene, if the exposure is still based on 18% gray, the white snow will be photographed as gray.
There are several simple scene switches on Polaroid (indoor, cloudy, sunny) that actually define the exposure intensity required in the current scene.
3. Metering area
Usually there are both bright and dark areas in a picture. If all areas are taken into account to calculate an average, it may not faithfully represent the photographer's expectations, so there will be a key metering area.
The metering area has different implementations according to different algorithms. The initial one is to divide the entire image area into M * N areas, and take the center X * Y area; mobile phones usually have metering for the face area, center metering There are three types of metering and spot metering; the metering area also has a certain weight distribution, and usually the area in the center has a greater weight.
Next, we will introduce three different automatic exposure methods: average method AE, histogram-improved average method AE, and N-segment statistical automatic exposure.
4. Mean method AE
The average method AE is a method for calculating the exposure intensity of the metering area. Based on the following formula, Output is the exposure output value we expect, which is the exposure intensity of 18% gray. Gamma is generally 2.2.
Input = 255 x (Output/255)gamma
If 0~255 is used as the calculation area on the grayscale card, then the Output of 18% gray is 122, and the Input is 50. That is, the actual exposure intensity of the metering area should be 50.
5. Histogram improved mean method AE
Let’s look back at the shortcomings of the concept of 18% gray mentioned in the third paragraph. The exposure value calculated in the case of snow scenes, night scenes or solid color backgrounds should not be 18% gray.
Then you need to use the histogram to moderately stretch the low-contrast image.
6. N-segment statistical method
The N-segment statistical method is a method used on mobile phone ISPs. As mentioned before, the aperture of the mobile phone sensor is fixed (only single-camera scenarios are considered here), so the only adjustable parameters are exposure time and ISO. Adjusting these two parameters on a mobile phone has its own pros and cons.
The main side effect of adjusting ISO is that it will also enhance the noise. If you enlarge the picture under dark light many times, the noise will be very obvious. Usually, the priority is to adjust the exposure time, but there is an upper limit for the exposure time, which must be completed within 33ms. Guaranteed preview frame rate of 30fps per second.
Therefore, N segments refer to different segments of ISO. Priority is given to adjusting the exposure time when the ISO is small. When the exposure time reaches the maximum value and still cannot be satisfied, increase the ISO one level and readjust the exposure time.
To sum up, the entire automatic exposure process is a process of continuously approaching the ideal value as shown in the figure below.