Knowledge about gamma (gamma, GAMMA value, photometric, gray level coefficient)

Source: Internet
Author: User

1. Where have you ever heard of Gamma?

 

* Also, Adobe Gamma
* It is often said that Mac's default GAMMA value is 1.8, while PC's value is 2.2.
* Gamma adjustment is available in the graphics card driver.
* I downloaded a software and can adjust the Gamma of the monitor.
* Windvd player with Gamma Correction
* Gamma can be adjusted in the exposure adjustment of ACDSee.
* The options of ACDSee include enable Gamma Correction.
* XV viewer can be started with the-Gamma 2.2 parameter (X Window can also be used)
* The PNG file contains Gamma Correction.
* In Photoshop, of course
* Is the ICC profile also related to Gamma?
* Cameras, digital cameras, scanners? Film ?...... Gamma's
......

What are these issues?


Figure: gamma settings on the video card (driver)


Figure: Exposure adjustment in ACDSee

2. What is Gamma?

  2.1. Display gamma curve

Gamma may be derived from the response curve of CRT (display/Television), that is, the nonlinear relationship between its brightness and input voltage.


Figure: response curve of a typical display, very close to the exponential function
(Note: The input value is digital, that is, the normal RGB value, but it can be understood that the number/mode conversion is linear, so it is equivalent to the input voltage)

After normalization, we can usually use a simple function to represent:

Output = input ^ Gamma

Gamma is the power of the exponential function.


Figure: normalized gamma curve

Note some characteristics of the curve:
* The endpoint remains unchanged, that is, no matter how the GAMMA value changes, the output of 0 is always 0, 1 and always 1 (this feature will be used ). This may be the reason why gamma is also called the "grayscale" coefficient.
* When gamma> 1, the curve is below the Gamma = 1 diagonal line; otherwise, it is above.

In addition, although the display is used as an example, it can be extended to input/output devices related to general images. The gamma curve should be ubiquitous. Even if it is not strictly exponential, it may still be called this way. At least the sensor in the digital host/camera that I know also has the gamma curve and Gamma Correction.

  2.2. Check the GAMMA value of the Display System

On PC, there seems to be no software method to obtain the GAMMA value of the system (4.1 will illustrate this ). Some people have made some pictures, which can be roughly estimated. The principle is similar to that of Adobe Gamma.


Figure: gamma comparison chart

Usage: similar to Adobe gamma, that is, blinking, standing farther, or taking off glasses with myopia. In short, when the left side is pasted into a piece, the brightness of a column on the right is the same as that on the left side. Note: If you have not performed any Gamma Correction (without software such as Adobe gamma, or if you have used it but set the correction coefficient to 1.0), the gamma of the display is measured, otherwise, it can only be called system gamma (or composite gamma ). For example, the Gama value of the author's Acer al1916w is about 2.0.

In addition, you can know the Gamma of the display by using the ICC profile that comes with the display. This should be accurate.

 

3. What is Gamma Correction?

  There are many steps between a digital image file and the image we finally see. In almost any stage, some transformations can be added to change the relationship between the final output and the initial input (Similarly, this relationship is called system gamma or composite gamma ).

For example, for a display with Gamma = 2.5, before the data is transferred to the display, make a Gamma = 0.4 Transformation (for example, for the data in the video card cache, d' = d ^ 0.4), so that a linear relationship can be obtained from the whole.

Note that there is a bit of confusion here. We usually call a Gamma = C correction, which refers to the transformation of output = input ^ (1/C. There is a reciprocal relationship.


Figure: Gamma Correction

For PCs, the gamma value of the display is about 2.2 (more than 2.5 may have been used before, but now it seems to be 2.2). Generally, there is no built-in correction, therefore, Adobe gamma has a default correction coefficient of 2.2 For Windows systems. For Mac, the gamma value of the display is 2.5, and the hardware has a built-in 1.4 correction. Therefore, it requires 2.5/1.4 ~ = 1.8 is linear. The Gamma Correction process in various systems is described in more detail below.

Iv. Where can Gamma Correction occur?

  4.1. system level (hardware and operating system)

  No compensation has been heard in the monitor, and even if there is, they also present a certain GAMMA value.

The main compensation occurs in the graphics card and its driver class. If the graphics card hardware is not supported, the driver software completes. In Windows, the upper layer transmits a Gamma Correction table (LUT) to the driver by calling an interface function (drvicmsetdevicegammaramp ), the table size is 3*256 Items (each item is 16 bytes), which corresponds to three RGB channels, each of which is 256 levels.

To describe this detail, you can be more confident about some things:
* This correction can actually be any function, not limited to an exponential function whose gamma is the power.
* Because of this, the system GAMMA value cannot be obtained through the driver (because only the table can be obtained at most ).
* This setting is effective for the entire system (any program and any images displayed are affected by it ).

I have never understood what the relationship between adobe gamma and the driver gamma is before. Some people say they work together. Now I fully understand that there is no superposition relationship, and the final setting is valid. Moreover, Adobe gamma does not have to be (or actually not) a resident program. It only passes the table to the driver at startup to complete its tasks.

You can also use other programs to correct/set Gamma. The following is a convenient tool: gamma panel. (To view the images in this article, you need to change gamma frequently. It is best to set the next one, free .)


Figure: gamma panel, a tool for correcting system Gamma

4.2. application-level

If the premise is reached, some playing software has the Gamma Correction function and the ACDSee function. At this time, they do not modify the Gamma Correction table of the system, but perform real-time gamma transformation on the current frame/image during decoding.


Figure: the Gamma Correction function can be loaded when ACDSee browses images.
On the left side of the graph is the same image opened by IE (without Gamma Correction). We can see that their brightness is different. (However, the black box and white side are the same .)

  4.3. File-level

As mentioned above (Figure 1-2 exposure adjustment in ACDSee), some image processing software can adjust the Gamma of a file, the result of this adjustment will be written into the file (that is, it is equivalent to some processing of the image ). For example, when your PC does not undergo Gamma Correction (your system Gamma = the Gamma of the display is about 2.2), you can adjust the GAMMA value of the file to 2.2 to save it, you and other PC users without correction system Gamma should see this picture exactly. (Note: The premise here is that the original image is "exactly" on the system where Gamma = 1.

Another method is to write the Gamma Correction Coefficient into the file without changing the file content, when decoding the image, the browser/processing software individually performs Gamma Correction Based on this parameter. (This is called "file Gamma ". PNG format supported)

In short, Gamma Correction is equivalent (ideally/or approximately) regardless of where it occurs ). Understand where gamma has changed, and then perform some multiplication and division.

 

V. Changing the effect of Gamma

5.1. Changes in Audio and Video Effects

The general feeling is that the system gamma is high, and the image is dimmed. After correction, the image is brightened.

Observe the following picture.

Two corresponding file Gamma = 2.5 images are used to simulate system gamma changes. Alternatively, you can use tools such as gamma panel to set the Gamma Correction Coefficient to 1.0 ~ 2.5 observation (1st images in each group ).


Image Grayscale 0-128, file Gamma = 1.0


Image Grayscale 0-128, file Gamma = 2.5


Figure gray scale 128-255, file Gamma = 1.0


Figure gray scale 128-255, file Gamma = 2.5


Figure: An Example of intuitively adjusting the GAMMA value

Conclusion:
* When the system gamma is high (Gamma Correction = 1.0), you can see a wide range of hidden images; otherwise, multiple bright images are available.
* If the Gamma Correction is set to 2.5, the file Gamma = 2.5 Image is displayed, which is equivalent to the file Gamma = 1.0 image when the correction is set to 1.0.

  5.2. color changes

  Obviously, Gamma changes bring about brightness changes. Changing the Gamma of a channel alone will lead to a change in hue.

        
Gamma Correction = 1.0 Gamma Correction = 2.5
Source output source output
R 80% R 57% R 80% R 80%
G 20% G ~ 0% GB 20% g 20%
B 20% B ~ 0% B 20% B 20%

Of course, if the display is partial, we can change the Gamma of a channel to maintain a balanced overall.

  5.3. Others

Other influences are described or mentioned later.

6. Reasons for correcting Gamma

  It mainly refers to whether the system gamma is to be corrected to 1.0. Because correction always exists. (Same below)

  6.1. Standardization and interchangeable

  If a digital camera/Scanner gives you a Gamma = 1.0 image, you 'd better view it on the system Gamma = 1.0; or when your digital image is to be output, system Gamma = 1.0 ;......

(This part involves the color space and ICC profile. I am not quite clear about it, and there are very limited devices to come into contact .)

  6.2. algorithm requirements

  Gamma is required when a mixture of different gray levels is involved. In a simple example, when filling, half of the Black (0) + half of the white (255), the effect should be the same as 50% of the gray (128. However, this is only true when system Gamma = 1.0.

Another example is that the color is converted into black and white. The 30% R + 59% G + 11% B is also for Gamma = 1.0.

Similarly, many algorithms target 1.0 system Gamma. Otherwise, Gamma Correction is performed in the algorithm.

The following is an example of anti-alias.


Figure: General edge

Because a diagonal line can only be drawn in the dot matrix of a rectangle, and the pixel value of the diagonal line is full black, when the diagonal line is steep (or flat), it will have a significant sense of sawtooth.


Figure: After Anti-alias is used, the Sawtooth effect is not so obvious.

Zoom in on the image in Photoshop and you will find that the edge is not all black, but gradient. (This is an intuitive understanding of Anti-alias .)
Note: Do not use ACDSee to zoom in. The default algorithm of ACDSee is interpolation, so you cannot see the original appearance of pixels.


Figure: After Anti-alias is corrected with gamma, the Sawtooth effect disappears completely.

Of course, if you keep the system Gamma = 1.0 to view the above image, you will find that 2nd images are completely non-sawtooth, but 3rd images have a little bit. (Can this be used as a method to estimate system gamma)

 

 

VII. Reasons for not correcting Gamma

7.1. Non-standardization of reality

  Suppose that your image is published as a web, will your user (audience) system gamma be 1.0? Even if it can be assumed that the color-less kimchi will use Adobe gamma to correct their system gamma to around 1.0, what about most common users? -- Before getting started with Photoshop, I didn't know what gamma was.

You may have to make a compromise. (Mac is only corrected to 1.8 by hardware, and SGI is only corrected to 1.4. I wonder if there is any reason for this .)


Making good cross platform and WWW pictures

The Default User Interface Design of the operating system we face all day is based on the system GAMMA value? -- Setting 1.0 is not the most comfortable.

The PNG file format provides the Gamma compensation function, but it is not popular because people do not know how much gamma their system is (of course there are other reasons ).

Related News: the sad story of PNG gamma "correction"

  7.2. Better visual features

  In terms of human perception, the psychological volume and physical quantity are usually in a logarithm relationship, and the vision is no exception. Although this logarithm relationship does not strictly correspond to that index, it is in the same direction. That is, the darker the perception (sensitive to changes in the same light intensity), and the (uncorrected) display gamma curve (GAMMA value greater than 1 ), it is also more layers corresponding to the hidden area.

For example, for Gamma = 2, the division is based on the intensity of half of the Light, 0 ~ 182 corresponds to the dark half, 182 ~ 255 corresponds to half of bright.

  7.3. The number of colors may be reduced.

  This is caused by the rounding error of the number. The input data is calculated based on eight digits per channel. When the accuracy of the video card (DAC) is only eight digits, this will happen.

X =; y = uint8 (x/255). ^ gamma * 255); n = histc (Y, x); Count = sum (n> 0)

When Gamma = 2 (or 0.5), The result COUNT = 192, that is, 256 color is changed to 192 color. If the three-channel GAMMA value (Correction System) is the same, the total number of colors is 192 ^ 3 = 707,788, and the 24-digit original color is 16,777,216.

Of course, this problem does not exist for 10-bit, 12-bit and higher-level graphics cards. (I have never understood the significance of a higher video card on an 8-bit color system. Now I feel a little bit .)

8. Conclusion

Gamma is a basic element. People who care about graphics and images should give them a little attention.

If you don't correct the system gamma to 1.0, it seems that there are not too many errors. At least you and the masses are on the side. To what extent, there are both a compromise and a taste factor. However, it is necessary not to take a partial color. When the standard needs to be corrected, you 'd better follow the standard. In short, it depends on who your image is connected ".

Gamma is only part of the ICC profile. We may be able to fully understand the standards and swapping issues only after we have understood color management.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.