Gamma correction

Uses your system voice; voice and rate in settings.

Snapshot

≈ 4 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Gamma correction or gamma is a nonlinear operation used to encode and decode luminance in video or images. Gamma correction is, in the simplest cases, defined by the following power-law expression: : V_\text{out} = A V_\text{in}^\gamma, where the non-negative real input value V_\text{in} is raised to the power \gamma and multiplied by the constant A to get the output value V_\text{out} .

In the common case of , inputs and outputs are typically in the range 0–1. A gamma value \gamma is sometimes called an encoding gamma, and the process of encoding with this compressive power-law nonlinearity is called gamma compression; conversely, a gamma value \gamma > 1 is called a decoding gamma, and the application of the expansive power-law nonlinearity is called gamma expansion.

Gamma correction or gamma is a nonlinear operation used to encode and decode luminance in video or images. Gamma correction is, in the simplest cases, defined by the following power-law expression: V_\text{out} = A V_\text{in}^\gamma, where the non-negative real input value V_\text{in} is raised to the power \gamma and multiplied by the constant A to get the output value V_\text{out} .

In the common case of , inputs and outputs are typically in the range 0–1. A gamma value \gamma is sometimes called an encoding gamma, and the process of encoding with this compressive power-law nonlinearity is called gamma compression; conversely, a gamma value \gamma > 1 is called a decoding gamma, and the application of the expansive power-law nonlinearity is called gamma expansion.

The concept of gamma can be applied to any nonlinear relationship. For the power-law relationship V_\text{out} = V_\text{in}^\gamma , the curve on a log–log plot is a straight line, with slope everywhere equal to gamma (slope is represented here by the derivative operator): \gamma = \frac{\mathrm{d} \log(V_\text{out})}{\mathrm{d} \log(V_\text{in})}.

That is, gamma can be visualized as the slope of the input–output curve when plotted on logarithmic axes. For a power-law curve, this slope is constant, but the idea can be extended to any type of curve, in which case gamma (strictly speaking, "point gamma" ) is defined as the slope of the curve in any particular region.

Gamma correction in computers is used, for example, to display a gamma = 1.8 Apple picture correctly on a gamma = 2.2 PC monitor by changing the image gamma. Another usage is equalizing of the individual color-channel gammas to correct for monitor discrepancies.

Paradoxically, when upsampling (scaling up) an image, the result processed in a "wrong" (non-physical) gamma color space is often more aesthetically pleasing. This is because resampling filters with negative lobes like Mitchell–Netravali and Lanczos create ringing artifacts linearly even though human perception is non-linear and better approximated by gamma.

(Emulating "stepping back," which motivates downsampling in linear light (gamma=1), does not apply when upsampling.) A related method of reducing the visibility of ringing artifacts consists of using a sigmoidal light transfer function as pioneered by ImageMagick and GIMP's LoHalo filter and adapted to video upsampling by madVR, AviSynth and Mpv.

Inverting a high-contrast image (such as text) by doing 1-x looks correct (same weight of the letters) in a gamma space. Also several of the "Photoshop operations" (overlay, hard light, soft light, etc) were designed to work in gamma space and look incorrect in linear space. These functions must be adjusted to work in a different gamma or linear space.

Programmers must also watch out for whether "premultiplication" by the alpha was done before or after converting to the stored space, and whether the alpha channel itself is linear or gamma corrected. Gamma error in picture scaling by Eric Brasseur WHAT EVERY CODER SHOULD KNOW ABOUT GAMMA by JOHN NOVAK

Text derived from https://en.wikipedia.org/w/index.php?oldid=1374196278 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

34 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.