Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
isp:contrast [2023/09/05 05:17] – [In RGB color space] Igor Yefmov | isp:contrast [2023/09/10 21:53] (current) – [Integer arithmetic] Igor Yefmov | ||
---|---|---|---|
Line 7: | Line 7: | ||
===== In RGB color space ===== | ===== In RGB color space ===== | ||
- | As with the [[isp:: | ||
- | Traditionally | + | Each component' |
\[ | \[ | ||
- | lum = 0.2126 * R + 0.7152 * G + 0.0722 * B | + | component |
+ | component' | ||
+ | contrast \in ]0..2.0]%% | ||
\] | \] | ||
- | + | ==== Integer arithmetic ==== | |
- | With that in mind each component's contrast | + | Of course, much like in [[isp:: |
\[ | \[ | ||
- | component = (component - 50*k) * contrast^2 + 50*k \\ | + | \frac{ |
- | luma \in [0..100] \\ | + | \left(\begin{bmatrix} |
- | contrast \in ]0..2.0]%% | + | R \\ |
- | \] | + | G \\ |
- | + | B | |
- | which looks like this: | + | |
- | + | ||
- | \[ | + | |
- | \begin{bmatrix} | + | |
- | R - 50 * 0.2126 | + | |
- | G - 50 * 0.7152 | + | |
- | B - 50 * 0.0722 | + | |
- | \end{bmatrix} \times contrast^2 | + | |
- | + | + | |
- | \begin{bmatrix} | + | |
- | 50 * 0.2126 \\ | + | |
- | 50 * 0.7152 \\ | + | |
- | 50 * 0.0722 | + | |
\end{bmatrix} | \end{bmatrix} | ||
- | \] | + | - |
- | + | ||
- | which easily simplifies to | + | |
- | + | ||
- | \[ | + | |
\begin{bmatrix} | \begin{bmatrix} | ||
- | R - 10.63 \\ | + | 2047 \\ |
- | G - 35.76 \\ | + | 2047 \\ |
- | B - 3.61 | + | 2047 |
- | \end{bmatrix} \times contrast^2 | + | \end{bmatrix} |
- | + | + | }{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:: | ||
===== In HSL color space ===== | ===== In HSL color space ===== |