Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
isp:contrast [2023/09/06 09:55] – [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' |
- | \] | + | |
- | + | ||
- | + | ||
- | + | ||
- | With that in mind each component' | + | |
- | + | ||
- | \[ | + | |
- | component = (component' | + | |
component' | component' | ||
contrast \in ]0..2.0]%% | contrast \in ]0..2.0]%% | ||
\] | \] | ||
- | which looks like this: | ||
- | \[ | + | ==== Integer arithmetic ==== |
- | \begin{bmatrix} | + | Of course, much like in [[isp:: |
- | R - 0.5 \\ | + | |
- | G - 0.5 \\ | + | |
- | 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 | + | |
- | + | + | |
- | \begin{bmatrix} | + | |
- | 0.5 \\ | + | |
- | 0.5 \\ | + | |
- | 0.5 | + | |
- | \end{bmatrix} \\ | + | |
- | R, G, B \in [0..1.0] \\ | + | |
- | contrast \in [0..2.0] | + | |
- | \] | + | |
- | + | ||
- | Of course, much like in [[isp:: | + | |
\[ | \[ | ||
Line 63: | Line 32: | ||
2047 \\ | 2047 \\ | ||
2047 | 2047 | ||
- | \end{bmatrix} \right) | + | \end{bmatrix} \right) \times contrast^2 |
- | \begin{bmatrix} | + | }{1024*1024} + |
- | 47394 & 0 & 0 \\ | + | |
- | 0 & 536358 & 0 \\ | + | |
- | 0 & 0 & 5466 | + | |
- | \end{bmatrix} | + | |
- | }{1024*1024*1024*1024} + | + | |
\begin{bmatrix} | \begin{bmatrix} | ||
2047 \\ | 2047 \\ | ||
2047 \\ | 2047 \\ | ||
2047 | 2047 | ||
- | \end{bmatrix} | + | \end{bmatrix} |
- | + | ||
- | R, G, B \in [0..4095] \\ | + | |
- | contrast \in [0..2048] | + | |
\] | \] | ||