User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
isp:brightness [2022/04/04 23:32] – external edit 127.0.0.1isp:brightness [2023/09/05 04:36] Igor Yefmov
Line 4: Line 4:
  
 Again, in the simplest terms, increasing or reducing pixel's brightness can be interpreted as adding or subtracting a fixed "gain" value (others may argue that a more natural approach would be to use a multiplier, while others still may bring the "vibrancy" approach into picture). Again, in the simplest terms, increasing or reducing pixel's brightness can be interpreted as adding or subtracting a fixed "gain" value (others may argue that a more natural approach would be to use a multiplier, while others still may bring the "vibrancy" approach into picture).
 +
 +===== In RGB color space =====
 +In RGB color space the operation is a matrix multiplication of the RGB's vector by a given "brightness" matrix. However we should make sure that the relative proportion of color channels is preserved so that the colors are not washed out.
 +
 +Considering that the luminance is calculated as
 +
 +\[lum = 0.2126 * R + 0.7152 * G + 0.0722 * B\]
 +
 +Further consider that the brightness is simply a "boost" to RGB components, or in other words: gains. And as such all that is needed is to add the brightness \(br\) proportionally to each channel:
 +
 +\[
 +\begin{bmatrix}
 +R' \\
 +G' \\
 +B'
 +\end{bmatrix}
 +=
 +\begin{bmatrix}
 +R + 0.2126 * br \\
 +G + 0.7152 * br \\
 +B + 0.0722 * br
 +\end{bmatrix}
 +\]
 +
 +Of course when implemented on FPGA the preference is to use integer arithmetic, which can be easily achieved by an approximation, considering that \(2^{10} = 1024 \approx 1000\) (which is "good enough" for us:
 +
 +\[
 +\begin{bmatrix}
 +R' \\
 +G' \\
 +B'
 +\end{bmatrix}
 ++=
 +\begin{bmatrix}
 +213 * br \\
 +715 * br \\
 +72 * br
 +\end{bmatrix} / 1024
 +\]
 +
 +===== In HSL color space =====
 +When using the HSL color space the adjustment is as simple as elementary school's arithmetic operation. Namely - just a simple addition.
  
 With that the implementation of the Brightness adjustment can be as simple as the following (where the "luma", or brightness component \(\in[0..100]%%\)): With that the implementation of the Brightness adjustment can be as simple as the following (where the "luma", or brightness component \(\in[0..100]%%\)):

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information