Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
isp:contrast [2023/09/05 05:17] – [In RGB color space] Igor Yefmov | isp:contrast [2023/09/06 10:35] – [In RGB color space] Igor Yefmov | ||
---|---|---|---|
Line 9: | Line 9: | ||
As with the [[isp:: | As with the [[isp:: | ||
- | Traditionally the luminance is calculated as | + | Traditionally the luminance is calculated as (see [[isp: |
\[ | \[ | ||
Line 20: | Line 20: | ||
\[ | \[ | ||
- | component = (component - 50*k) * contrast^2 + 50*k \\ | + | component = (component' |
- | luma \in [0..100] \\ | + | component' |
contrast \in ]0..2.0]%% | contrast \in ]0..2.0]%% | ||
\] | \] | ||
Line 29: | Line 29: | ||
\[ | \[ | ||
\begin{bmatrix} | \begin{bmatrix} | ||
- | R - 50 * 0.2126 \\ | + | R - 0.5 \\ |
- | G - 50 * 0.7152 \\ | + | G - 0.5 \\ |
- | B - 50 * 0.0722 | + | B - 0.5 |
+ | \end{bmatrix} | ||
+ | | ||
+ | \begin{bmatrix} | ||
+ | 0.2126^2 & 0 & 0 \\ | ||
+ | 0 & 0.7152^2 & 0 \\ | ||
+ | 0 & 0 & 0.0722^2 | ||
\end{bmatrix} \times contrast^2 | \end{bmatrix} \times contrast^2 | ||
+ | + | ||
\begin{bmatrix} | \begin{bmatrix} | ||
- | 50 * 0.2126 \\ | + | 0.5 \\ |
- | 50 * 0.7152 \\ | + | 0.5 \\ |
- | 50 * 0.0722 | + | 0.5 |
\end{bmatrix} | \end{bmatrix} | ||
\] | \] | ||
- | which easily simplifies | + | ==== Integer arithmetic ==== |
+ | Of course, much like in [[isp:: | ||
\[ | \[ | ||
+ | \frac{ | ||
+ | \left(\begin{bmatrix} | ||
+ | R \\ | ||
+ | G \\ | ||
+ | B | ||
+ | \end{bmatrix} | ||
+ | - | ||
+ | \begin{bmatrix} | ||
+ | 2047 \\ | ||
+ | 2047 \\ | ||
+ | 2047 | ||
+ | \end{bmatrix} \right) | ||
\begin{bmatrix} | \begin{bmatrix} | ||
- | R - 10.63 \\ | + | 47394 & 0 & 0 \\ |
- | G - 35.76 \\ | + | 0 & 536358 & 0 \\ |
- | B - 3.61 | + | 0 & 0 & 5466 |
\end{bmatrix} \times contrast^2 | \end{bmatrix} \times contrast^2 | ||
- | + | + | }{1024*1024*1024*1024} |
\begin{bmatrix} | \begin{bmatrix} | ||
- | 10.63 \\ | + | 2047 \\ |
- | 35.76 \\ | + | 2047 \\ |
- | 3.61 | + | 2047 |
- | \end{bmatrix} | + | \end{bmatrix} \\ |
- | \] | + | |
- | Of course, much like in [[isp:: | + | R, G, B \in [0..4095] \\ |
+ | contrast | ||
+ | |||
+ | \] | ||
===== In HSL color space ===== | ===== In HSL color space ===== |