Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
isp:automatic_exposure [2018/06/04 12:58] – Igor Yefmov | isp:automatic_exposure [2022/04/04 23:32] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 5: | Line 5: | ||
====== Effects of Black Level, Gains, and " | ====== Effects of Black Level, Gains, and " | ||
- | Below are a few sections that provide a bit of information on what effect each of the 3 types of digital settings have on the output image | + | Below are a few sections that provide a bit of information on what effect each of the 3 types of digital settings have on the output image. |
===== Black Level ===== | ===== Black Level ===== | ||
- | [[https:// | + | [[https:// |
- | Remember: the brighter the pixel the **lower** | + | Remember: the brighter the pixel, the **lower** |
===== Gains ===== | ===== Gains ===== | ||
Line 19: | Line 19: | ||
==== Individual color channel gains ==== | ==== Individual color channel gains ==== | ||
- | There are 3 individual Gain settings for each of the 3 color channels (Red, Green, Blue) and those are applied to pixel data corresponding to that color. Naturally changing these values has a profound effect on the output color. | + | There are 3 individual Gain settings for each of the 3 color channels (Red, Green, Blue) and those are applied to pixel data corresponding to that color. Naturally changing these values has a profound effect on the output color. The offset to increasing gain is that it will increase the noise. |
==== Global Gain ==== | ==== Global Gain ==== | ||
- | Global Gain is a Gain that is applied to **every** pixel. Adjusting this setting greatly affects the brightness of the picture while only minimally affecting the color balance. | + | Global Gain is a Gain that is applied to **every** pixel. Adjusting this setting greatly affects the brightness of the picture while only minimally affecting the color balance. The offset to increasing gain is that it will increase the noise. |
===== " | ===== " | ||
- | The timing generator outputs clocks to access the rows of the imaging array, | + | The timing generator outputs clocks to access the rows of the imaging array, |
The exposure time is controlled by adjusting the time interval between pre-charging and sampling. After the data of the pixels in the row has been sampled, it is processed through analog circuitry to correct the offset and multiply the data with corresponding Gain. Following analog processing is the ADC which outputs 10, 12, or 14 bits((depends on the sensor chip's model)) of data for each pixel in the array. | The exposure time is controlled by adjusting the time interval between pre-charging and sampling. After the data of the pixels in the row has been sampled, it is processed through analog circuitry to correct the offset and multiply the data with corresponding Gain. Following analog processing is the ADC which outputs 10, 12, or 14 bits((depends on the sensor chip's model)) of data for each pixel in the array. | ||
Line 70: | Line 70: | ||
Once we have the above two factors figured out the decision tree looks as follows: | Once we have the above two factors figured out the decision tree looks as follows: | ||
<code cpp> | <code cpp> | ||
- | enum class ExpCorrAction{STAY, INC, DEC}; | + | enum class ExpCorrAction{stay, inc, dec}; |
ExpCorrAction _needExpCorrection(int _right, double _adjY){ | ExpCorrAction _needExpCorrection(int _right, double _adjY){ | ||
- | if(_right > 60 && _adjY < 0.97){ | + | if(_right > 60 && _adjY < 1){ |
- | return ExpCorrAction:: | + | return ExpCorrAction:: |
} | } | ||
if(_right >= 250 && _adjY <= 1){ | if(_right >= 250 && _adjY <= 1){ | ||
- | return ExpCorrAction:: | + | return ExpCorrAction:: |
} | } | ||
- | if(_right < 240 && _adjY > 1.2){ | + | if(_right < 240 && _adjY > 1){ |
- | return ExpCorrAction:: | + | return ExpCorrAction:: |
} | } | ||
- | return ExpCorrAction:: | + | return ExpCorrAction:: |
} | } | ||
</ | </ | ||
Line 89: | Line 89: | ||
- If we have not reached the limit on Exposure setting - increase it by multiplying by the target/real brightness ratio | - If we have not reached the limit on Exposure setting - increase it by multiplying by the target/real brightness ratio | ||
- Else, if we have not hit the Global Gain limit - increase it by multiplying by the target/real brightness ratio | - Else, if we have not hit the Global Gain limit - increase it by multiplying by the target/real brightness ratio | ||
- | - Else (special case!) **only** if the auto-white balance is currently turned **on** and if the brightness adjustment is very high (above '' | + | - Else (special case!) **only** if the auto-white balance is currently turned **on** and if the brightness adjustment is very high (above '' |
- Never increase the Green Gain beyond '' | - Never increase the Green Gain beyond '' | ||
- Only increase the Green Gain as much as to not cause the overflow for the Gains in Red or Blue channels (take a conservative guess and then lower it by another '' | - Only increase the Green Gain as much as to not cause the overflow for the Gains in Red or Blue channels (take a conservative guess and then lower it by another '' | ||
Line 106: | Line 106: | ||
In order to automate this process one could think of Black Level as the counterpart to the overexposure. The goal is to have the Black Level set at such value as to ensure that there are no more than specified overexposure pixel count that are pitch black. | In order to automate this process one could think of Black Level as the counterpart to the overexposure. The goal is to have the Black Level set at such value as to ensure that there are no more than specified overexposure pixel count that are pitch black. | ||
- | ====== Further improvements ====== | + | ===== Sample implementation in C++ ===== |
+ | [[Sample AE implementation in C++]] shows one possible implementation of the approach described above. It does use (without much explanation) some of the external structures, but those should not be hard to comprehend from their usage |