dipityPix app

Friday, December 15, 2006

Gamma correction

Most graphics monitors have a "gamma" that gives a rough approximation to their non-linearity. For example, if we use an internal color space where all of R, G, B are stored as 0 to 1 values, then the physical spectra coming from the red part of the pixel would be:

output_red( lambda ) = max_output_red(lambda) * pow( R, gamma )

where gamma is typically a number around 2.0. Suppose gamma is 2.0. If we want to display a red that is 1/4 the maximum, the R would would store in a file to send to the display would be 0.5.

Note that all of this is not to make up for some "defect" in the monitor. When you use 8-bit per channel color representations, there are only 256 gray levels available. If you space these out so they LOOK evenly spaced to a human observer, that makes a perceptually uniform set of 256 grays and banding is minimized. But since human intensity perception is non-linear (think of the "middle gray" photographer's card which is physically about 1/5 the rreflectance of white paper), this means the monitor must be as well.