伽马校正(Gamma Correction)
为什么需要伽马校正?
部分人认为,是由于早期CRT显示器的输出亮度和输入电压存在非线性关系,具体就是近似2.2次幂的关系,导致显示器的亮度要比计算机上存储的亮度要低。
举个例子:假如你计算机存储的亮度是0.5(亮度范围是0~1),CRT显示器的输出亮度并不是0.5,而是约等于 0.218,具体计算过程如下
o u t p u t = i n p u t 2.2 output = input^{2.2} output=input2.2
当你输入0.5时,输出到显示器的值为
o u t p u t = 0. 5 2.2 ≈ 0.218 output = 0.5^{2.2} \approx 0.218 output=0.52.2≈0.218
其中2.2这个指数就是伽马值,而显示器的这种非线性输出过程称为伽马展开(gamma expansion)。
为了能够得到正确的输出,必须对输入进行补偿,方法是对输入进行一次指数为1/2.2的幂次运算,这个补偿的过程就是伽马校正:
i n p u t ⟶ i n p u t 1 2.2 input \longrightarrow input^{\frac{1}{2.2}} input⟶input2.21
经过伽马校正后,显示器便能正确显示我们的输入了 :
{ i n p u t ⟶ i n p u t 1 2.2 o u t p u t = ( i n p u t 1 2.2 ) 2.2 = i n p u t \left\{ \begin{aligned} input& \longrightarrow input^{\frac{1}{2.2}} \\ output& = (input^{\frac{1}{2.2}})^{2.2} = input \end{aligned} \right. {
input