Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
isp:automatic_white_balance [2018/06/14 14:47] – [Sample implementation in C++] Igor Yefmov | isp:automatic_white_balance [2022/04/04 23:32] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 31: | Line 31: | ||
- Perform the [[https:// | - Perform the [[https:// | ||
- Calculate the pixel' | - Calculate the pixel' | ||
- | - '' | + | - \(\frac{|U| + |V|}{Y} < threshold, U \in [-127..+127], V \in [-127..+127], Y \in [0..255], threshold |
- Of course one should be careful about dividing by '' | - Of course one should be careful about dividing by '' | ||
- If the '' | - If the '' | ||
Line 44: | Line 44: | ||
==== Calculate color properties ==== | ==== Calculate color properties ==== | ||
- | Now that we have our data set we can figure out what our picture looks like from the color balance point of view. For that we just calculate the average values of '' | + | Now that we have our data set we can figure out what our picture looks like from the color balance point of view. For that we just calculate the average values of \(U\) and \(V\). The simplest approach is to calculate the [[https:// |
At the end of this step we have the following 3 sets of numbers: | At the end of this step we have the following 3 sets of numbers: | ||
- | - "Main results" | + | - "Main results" |
- | - Calculate the " | + | - Calculate the " |
- | - Use the '' | + | - Use the \(Y\) from [[#Collect statistical data set|previous step]] (if it was collected) or just go with the value of \(100\) which is hopefully a good representation of a well-adjusted overall brightness |
- | - Calculate the two ratios that represent how far off the '' | + | - Calculate the two ratios that represent how far off the '' |
==== Figure out the adjustment ==== | ==== Figure out the adjustment ==== | ||
Line 56: | Line 56: | ||
Now that we have all the information we need to make a decision let's make one! | Now that we have all the information we need to make a decision let's make one! | ||
- | - If the **absolute** value of average | + | - If the **absolute** value of average |
- Be careful not to overflow beyond the sensor gain's cap | - Be careful not to overflow beyond the sensor gain's cap | ||
- If the gain is already at 0 and needs to be increased - make sure you use addition, as multiplication won't help you((or just make sure you never adjust the color channel' | - If the gain is already at 0 and needs to be increased - make sure you use addition, as multiplication won't help you((or just make sure you never adjust the color channel' | ||
- | - Same for the '' | + | - Same for the '' |
- | The '' | + | The '' |
===== Sample implementation in C++ ===== | ===== Sample implementation in C++ ===== | ||
[[Sample AWB 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 deduce from their usage | [[Sample AWB 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 deduce from their usage |