Gamma correction

[1] Gamma correction is, in the simplest cases, defined by the following power-law expression: where the non-negative real input value

[4] Although gamma encoding was developed originally to compensate for the brightness characteristics of cathode-ray tube (CRT) displays, that is not its main purpose or advantage in modern systems.

Altering the input signal by gamma compression can cancel this nonlinearity, such that the output picture has the intended luminance.

[1][3] The similarity of CRT physics to the inverse of gamma encoding needed for video transmission was a combination of coincidence and engineering, which simplified the electronics in early television sets.

[6] For this reason, considerable artistic effort is invested in choosing the reduced form in which the original image should be presented.

The gamma correction, or contrast selection, is part of the photographic repertoire used to adjust the reproduced image.

[8][9] Since both axes use logarithmic units, the slope of the linear section of the curve is called the gamma of the film.

For television signals, gamma values are fixed and defined by the analog video standards.

The sRGB color space standard used with most cameras, PCs, and printers does not use a simple power-law nonlinearity as above, but has a decoding gamma value near 2.2 over much of its range, as shown in the plot to the right/above.

The PNG specification includes the gAMA chunk for this purpose[14] and with formats such as JPEG and TIFF the Exif Gamma tag can be used.

This made it impossible for PNG images to simultaneously match HTML or untagged JPG colors on every device.

Ebner and Fairchild[20] used an exponent of 0.43 to convert linear intensity into lightness (luma) for neutrals; the reciprocal, approximately 2.33 (quite close to the 2.2 figure cited for a typical display subsystem), was found to provide approximately optimal perceptual encoding of grays.

The light intensity I is related to the source voltage Vs according to where γ is the Greek letter gamma.

For a CRT, the gamma that relates brightness to voltage is usually in the range 2.35 to 2.55; video look-up tables in computers usually adjust the system gamma to the range 1.8 to 2.2,[1] which is in the region that makes a uniform encoding difference give approximately uniform perceptual brightness difference, as illustrated in the diagram at the top of this section.

To compensate for this effect, the inverse transfer function (gamma correction) is sometimes applied to the video signal so that the end-to-end response is linear.

In LCDs such as those on laptop computers, the relation between the signal voltage Vs and the intensity I is very nonlinear and cannot be described with gamma value.

However, such displays apply a correction onto the signal voltage in order to approximately get a standard γ = 2.5 behavior.

All the encoding and correction methods can be arbitrarily superimposed, without mutual knowledge of this fact among the different elements; if done incorrectly, these conversions can lead to highly distorted results, but if done correctly as dictated by standards and conventions will lead to a properly functioning system.

In a typical system, for example from camera through JPEG file to display, the role of gamma correction will involve several cooperating parts.

The camera encodes its rendered image into the JPEG file using one of the standard gamma values such as 2.2, for storage and transmission.

In the test pattern, the intensity of each solid color bar is intended to be the average of the intensities in the surrounding dotted dither; therefore, ideally, the solid areas and the dithers should appear equally bright in a system properly adjusted to the indicated gamma.

The top two bars of the test image help to set correct contrast and brightness values.

The quality (and price) of the monitor determines how much deviation of this operating point still gives a satisfactory gamma correction.

With Microsoft Windows 7 and above the user can set the gamma correction through the display color calibration tool dccw.exe or other programs.

Some old graphics card drivers do not load the color Look Up Table correctly after waking up from standby or hibernate mode and show wrong gamma.

[34][35] Paradoxically, when upsampling (scaling up) an image, the result processed in a "wrong" (non-physical) gamma color space is often more aesthetically pleasing.

[36] 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.

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.

These distinctions, however, are largely irrelevant to gamma compression, which is applicable to any sort of normalized linear intensity-like scale.

[42] Note that luma is not directly calculated from luminance, it is the (somewhat arbitrary) weighted sum of gamma compressed RGB components.

The effect of gamma correction on an image: the original image was taken to varying powers, showing that powers larger than 1 make the shadows darker, while powers smaller than 1 make dark regions lighter. This is not the actual gamma the picture has, though.
Characteristic curve of a photographic film . The slope of its linear section is called the gamma of the film.
Plot of the sRGB standard gamma-expansion nonlinearity in red, and its local gamma value (slope in log–log space) in blue. The local gamma rises from 1 to about 2.2.
Gamma correction test image. Only valid at browser zoom = 100%