User Tools

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
isp:contrast [2023/09/06 10:37] – [Integer arithmetic] Igor Yefmovisp:contrast [2023/09/10 21:51] – [In RGB color space] Igor Yefmov
Line 7: Line 7:
  
 ===== In RGB color space ===== ===== In RGB color space =====
-As with the [[isp::brightness]] adjusting contrast in RGB color space requires us to pay attention to proportionally adjust the individual color components of the pixel to preserve their relative ratios. 
  
-Traditionally the luminance is calculated as (see [[isp:luminance]])+Each component's contrast adjustment is based on its value and the adjustment itself is calculated as
  
 \[ \[
-lum = 0.2126 * R + 0.7152 * G + 0.0722 * B +component = (component' - 0.5) * k^2 + 0.5 \\
-\] +
- +
- +
- +
-With that in mind each component's contrast adjustment is based on its luma's weight \(k\) and the adjustment itself is calculated as +
- +
-\[ +
-component = (component' - 0.5) * (contrast * k)^2 + 0.5 \\+
 component' \in [0..1.0] \\ component' \in [0..1.0] \\
 contrast \in ]0..2.0]%% contrast \in ]0..2.0]%%
 \] \]
  
-which looks like this: 
- 
-\[ 
-\begin{bmatrix} 
-R - 0.5 \\ 
-G - 0.5 \\ 
-B - 0.5 
-\end{bmatrix} 
- \times 
-\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} 
-\]  
  
 ==== Integer arithmetic ==== ==== Integer arithmetic ====

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