gamma校正什么意思_伽马校正系数

2022-11-08 19:02:24 浏览数 (2)

大家好,又见面了,我是你们的朋友全栈君。

UNDERSTANDING GAMMA CORRECTION

Gamma is an important but seldom understood characteristic of virtually all digital imaging systems. It defines the relationship between a pixel’s numerical value and its actual luminance. Without gamma, shades captured by digital cameras wouldn’t appear as they did to our eyes (on a standard monitor). It’s also referred to as gamma correction, gamma encoding or gamma compression, but these all refer to a similar concept. Understanding how gamma works can improve one’s exposure technique, in addition to helping one make the most of image editing.

gamma在数字图像系统中是一个很重要的概念或者说特性,但是却又很少有人理解。它定义了像素数值和真是亮度之间的关系。没有gamma,有数字摄像机捕捉到的明暗变化将不会是人眼看到的情况(标准显示器上显示的)。gamma 又叫做gamma correction,gamma编码或gamma压缩,这些都指的是同一个概念。理解了gamma的原理将会帮助人们调高曝光调节技术,而且能够帮助我们更好地利用图片编辑。

WHY GAMMA IS USEFUL

1. Our eyes do not perceive light the way cameras do. With a digital camera, when twice the number of photons hit the sensor, it receives twice the signal (a “linear” relationship). Pretty logical, right? That’s not how our eyes work. Instead, we perceive twice the light as being only a fraction brighter — and increasingly so for higher light intensities (a “nonlinear” relationship).

1.人眼和摄像机感知光线的原理是不一样的。对于摄像机:当有两倍的光线(光子)照射的时候,传感器将会感知到两倍的信号(线性关系)。正确的逻辑,对吧。但是这并不是人眼的的方式:当我们感知到有两倍的强度变化时,此时可能仅仅有一点点亮度变化。而且对于亮度的变化,人眼的感知是一直这样增长的。

Reference Tone

Perceived as 50% as Bright by Our Eyes

Detected as 50% as Bright by the Camera

Compared to a camera, we are much more sensitive to changes in dark tones than we are to similar changes in bright tones. There’s a biological reason for this peculiarity: it enables our vision to operate over a broader range of luminance. Otherwise the typical range in brightness we encounter outdoors would be too overwhelming.

和摄像机相比,人眼对暗色变化的感知要强于同等变化的亮色。也就是说人眼对于暗色的变化更加敏感。对于这种特性有着生物学的解释。使得人眼能够感知更宽的亮度范围。

But how does all of this relate to gamma? In this case, gamma is what translates between our eye’s light sensitivity and that of the camera. When a digital image is saved, it’s therefore “gamma encoded” — so that twice the value in a file more closely corresponds to what we would perceive as being twice as bright.

但是,这些怎么和gamma关联上呢?在这种情况下,gamma是转换人眼感光度和摄像机感光度之间的桥梁。当保存了一张数字图像,那么它就已经比gamma矫正过了—此时提高两倍图像文件的亮度人眼便会感知到有两倍的亮度增强。

Technical Note: Gamma is defined by Vout = Vingamma , where Vout is the output luminance value and Vin is the input/actual luminance value. This formula causes the blue line above to curve. When gamma<1, the line arches upward, whereas the opposite occurs with gamma>1.

注意:gamma的定义是:vout=vin**gamma,vout是亮度的输出值,vin是亮度的输入(实际采集到的值)。这个就是引起上图蓝线的原因。当gamma<1,曲线呈上拱形。

2. Gamma encoded images store tones more efficiently. Since gamma encoding redistributes tonal levels closer to how our eyes perceive them, fewer bits are needed to describe a given tonal range. Otherwise, an excess of bits would be devoted to describe the brighter tones (where the camera is relatively more sensitive), and a shortage of bits would be left to describe the darker tones (where the camera is relatively less sensitive):

2. gamma编码的图像能够更搞笑的保存色度。由于gamma编码重新分布的色度等级更加接近于人眼的感知,而且只需要较少的比特来表达色度范围。另一方面,额外的一些bit被用来表达较亮的色度(摄像机对于较亮的颜色较为敏感)。较少的bit被用来描述较暗的色调(摄像机对于暗色度不敏感)。

Original:

↓ Encoded using only 32 levels (5 bits)

Linear Encoding:

Gamma Encoding:

Notice how the linear encoding uses insufficient levels to describe the dark tones — even though this leads to an excess of levels to describe the bright tones. On the other hand, the gamma encoded gradient distributes the tones roughly evenly across the entire range (“perceptually uniform”). This also ensures that subsequent image editing, color andhistograms are all based on natural, perceptually uniform tones.

注意,线性编码采用了较少的bit来描述低色度–这样会使得有更多的比特来描述高色度。另一方面,gamma编码的梯度分布几乎是在整个色度空间的均匀分布(人眼感知均匀的)。这就保证了后续的图像编辑等工作。彩色,直方图都会基于这种自然地感知均匀分布的色度。

However, real-world images typically have at least 256 levels (8 bits), which is enough to make tones appear smooth and continuous in a print. If linear encoding were used instead, 8X as many levels (11 bits) would’ve been required to avoid image posterization.

然而,真实世界的图像最少采用256维的分级(8比特),这足以保证色度在打印时表现的光滑和连续了。如果采用了线性编码,将需要更多的分级(一般是11比特)来描述图片,因为只有更多的分级才能够避免图像高反差色调。

GAMMA WORKFLOW: ENCODING & CORRECTION

Despite all of these benefits, gamma encoding adds a layer of complexity to the whole process of recording and displaying images. The next step is where most people get confused, so take this part slowly. A gamma encoded image has to have “gamma correction” applied when it is viewed — which effectively converts it back into light from the original scene. In other words, the purpose of gamma encoding is for recording the image — not for displaying the image. Fortunately this second step (the “display gamma”) is automatically performed by your monitor and video card. The following diagram illustrates how all of this fits together:

尽管有这样的好处,但是gamma编码还是给图像的处理过程中带来了一定复杂性(在记录和表达图片的时候)。下一步将会是很多人困惑的地方,因此讲慢一点。通过gamma编码后的图片必须经过gamma校正才能够被浏览—指的是将它翻转回原来的原始场景色度(光照)。也就是说,gamma编码的过程是为了记录图片(保存图片)而不是显示图片。幸运的是,第二步(显示图片)是自动的有你的显示器或视频卡来完成的。

RAW Camera Image is Saved as a JPEG File

JPEG is Viewed on a Computer Monitor

Net Effect

=

1. Image File Gamma

2. Display Gamma

3. System Gamma

1. Image Gamma. This is applied either by your camera or RAW development software whenever a captured image is converted into a standard JPEG or TIFF file. It redistributes native camera tonal levels into ones which are more perceptually uniform, thereby making the most efficient use of a given bit depth.

1.图片gamma。这个步骤是通过你的摄像机或其他原始开发软件将一个被设备捕获到的图片转化为标准JPEG或TIFF时完成的。这个过程主要是重新分布摄像机的色度等级,得到更加感知均匀的分布,以此充分的利用给定的位深。

2. Display Gamma. This refers to the net influence of your video card and display device, so it may in fact be comprised of several gammas. The main purpose of the display gamma is to compensate for a file’s gamma — thereby ensuring that the image isn’t unrealistically brightened when displayed on your screen. A higher display gamma results in a darker image with greater contrast.

2.显示gamma。这个单指视频卡或者显示设备的影响,因此事实上这个步骤包括了很多个gamma。显示gamma主要目的是步长图片文件的gamma值—顺便保证在你显示器上显示的图片的亮度是稳定可靠的。越高的显示gamma会导致更高的对比度和更暗的图片。

3. System Gamma. This represents the net effect of all gamma values that have been applied to an image, and is also referred to as the “viewing gamma.” For faithful reproduction of a scene, this should ideally be close to a straight line (gamma = 1.0). A straight line ensures that the input (the original scene) is the same as the output (the light displayed on your screen or in a print). However, the system gamma is sometimes set slightly greater than 1.0 in order to improve contrast. This can help compensate for limitations due to the dynamic range of a display device, or due to non-ideal viewing conditions and image flare.

3.系统gamma.指的是所有gamma对图片的净影响,系统gamma同样指的是viewing gamma(显示gamma).如果要准确可靠地重现场景,这个gamma应该最好接近于直线(gamma=1.0)。直线的话能够保证输入(原始场景)和输出(你显示器或者屏幕或者打印的效果)是一样的。然而,通常情况,系统gamma的设置会略高于1.0以此来增强对比度。这有助于帮助补偿显示设备的动态范围的限制,或非理想视觉条件或图像耀斑~

IMAGE FILE GAMMA

The precise image gamma is usually specified by a color profile that is embedded within the file. Most image files use an encoding gamma of 1/2.2 (such as those using sRGB and Adobe RGB 1998 color), but the big exception is with RAW files, which use a linear gamma. However, RAW image viewers typically show these presuming a standard encoding gamma of 1/2.2, since they would otherwise appear too dark:

图片文件的gamma通常是由内置在文件中的color profile指定的。大多数图片文件使用gamma编码1/2.2(使用sRGB和Adobe RGB1998 色彩空间),但是在原始文件中却大多使用线性gamma。

Linear RAW Image (image gamma = 1.0)

Gamma Encoded Image (image gamma = 1/2.2)

If no color profile is embedded, then a standard gamma of 1/2.2 is usually assumed. Files without an embedded color profile typically include many PNG and GIF files, in addition to some JPEG images that were created using a “save for the web” setting.

Technical Note on Camera Gamma. Most digital cameras record light linearly, so their gamma is assumed to be 1.0, but near the extreme shadows and highlights this may not hold true. In that case, the file gamma may represent a combination of the encoding gamma and the camera’s gamma. However, the camera’s gamma is usually negligible by comparison. Camera manufacturers might also apply subtle tonal curves, which can also impact a file’s gamma.

DISPLAY GAMMA

This is the gamma that you are controlling when you perform monitor calibration and adjust your contrast setting. Fortunately, the industry has converged on a standard display gamma of 2.2, so one doesn’t need to worry about the pros/cons of different values. Older macintosh computers used a display gamma of 1.8, which made non-mac images appear brighter relative to a typical PC, but this is no longer the case.

Recall that the display gamma compensates for the image file’s gamma, and that the net result of this compensation is the system/overall gamma. For a standard gamma encoded image file (—), changing the display gamma (—) will therefore have the following overall impact (—) on an image:

Display Gamma 1.0

Display Gamma 1.8

Display Gamma 2.2

Display Gamma 4.0

Diagrams assume that your display has been calibrated to a standard gamma of 2.2. Recall from before that the image file gamma (—) plus the display gamma (—) equals the overall system gamma (—). Also note how higher gamma values cause the red curve to bend downward.

If you’re having trouble following the above charts, don’t despair! It’s a good idea to first have an understanding of how tonal curves impact image brightness and contrast. Otherwise you can just look at the portrait images for a qualitative understanding.

How to interpret the charts. The first picture (far left) gets brightened substantially because the image gamma (—) is uncorrected by the display gamma (—), resulting in an overall system gamma (—) that curves upward. In the second picture, the display gamma doesn’t fully correct for the image file gamma, resulting in an overall system gamma that still curves upward a little (and therefore still brightens the image slightly). In the third picture, the display gamma exactly corrects the image gamma, resulting in an overall linear system gamma. Finally, in the fourth picture the display gamma over-compensates for the image gamma, resulting in an overall system gamma that curves downward (thereby darkening the image).

The overall display gamma is actually comprised of (i) the native monitor/LCD gamma and (ii) any gamma corrections applied within the display itself or by the video card. However, the effect of each is highly dependent on the type of display device.

CRT Monitors

LCD (Flat Panel) Monitors

CRT Monitors. Due to an odd bit of engineering luck, the native gamma of a CRT is 2.5 — almost the inverse of our eyes. Values from a gamma-encoded file could therefore be sent straight to the screen and they would automatically be corrected and appear nearly OK. However, a small gamma correction of ~1/1.1 needs to be applied to achieve an overall display gamma of 2.2. This is usually already set by the manufacturer’s default settings, but can also be set during monitor calibration.

LCD Monitors. LCD monitors weren’t so fortunate; ensuring an overall display gamma of 2.2 often requires substantial corrections, and they are also much less consistent than CRT’s. LCDs therefore require something called a look-up table (LUT) in order to ensure that input values are depicted using the intended display gamma (amongst other things). See the tutorial on monitor calibration: look-up tables for more on this topic.

Technical Note: The display gamma can be a little confusing because this term is often used interchangeably with gamma correction, since it corrects for the file gamma. However, the values given for each are not always equivalent. Gamma correction is sometimes specified in terms of the encoding gamma that it aims to compensate for — not the actual gamma that is applied. For example, the actual gamma applied with a “gamma correction of 1.5” is often equal to 1/1.5, since a gamma of 1/1.5 cancels a gamma of 1.5 (1.5 * 1/1.5 = 1.0). A higher gamma correction value might therefore brighten the image (the opposite of a higher display gamma).

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/190861.html原文链接:https://javaforall.cn

0 人点赞