问题描述
当从RGB转换为灰度时,据说应该应用通道R,G和B的特定权重。这些权重是:0.2989,0.5870,0.1114。
据说这是因为人们对这三种颜色的感知/敏感性不同。有时也称这些是用于计算NTSC信号的值。
但是,我没有在网上找到这个参考。这些值的来源是什么?
另请参阅以前的这些问题:和。 / p>
问题中的具体数字来自CCIR 601(请参阅下面的维基百科链接)。
如果你使用稍微不同的数字/不同的方法转换RGB - >灰度,
在正常的光线条件下,你在正常的电脑屏幕上看不到太多的区别
-
这里有一些关于颜色的更多链接:
维基百科
的优秀网站
Ware,Information Visualization,isbn 1-55860-819-2;
此长链接到
可能或可能不起作用
:
优秀,精心编写的
如何获取,解释和处理数码照片的教程
使用强调概念而不是程序的视觉方法
如果你遇到线性和非线性RGB,
这里是一个旧的注意到我自己在这。
重复,在实践中你不会看到很多差别。
RGB - > ^ gamma - > Y - > L *
在颜色科学中,常见的RGB值如html rgb(10%,20%,30%
称为非线性或
。
线性值定义为
Rlin = R ^ gamma,Glin = G ^ gamma,Blin = B ^ gamma
其中gamma对于许多PC是2.2。
通常的RGB有时写成R'G'B'(R'= Rlin ^(1 / gamma))
(纯粹的舌头点击),但在这里我会放弃' CRT显示屏上的亮度与RGBlin = RGB ^ gamma,
成正比,因此CRT上的50%灰色非常暗:.5 ^ 2.2 = 22%的最大亮度。
(LCD显示更复杂;
此外,一些显卡补偿伽马)
要获得亮度的测量称为 L *
来自RGB,
先将RGB除以255,然后计算
Y = .2126 * R ^ gamma + .7152 * G ^ gamma + .0722 * B ^ gamma
这是XYZ颜色空间中的 Y
;它是颜色亮度的度量。
(实际公式不完全是x ^伽玛,但是关闭;
第一次使用x ^伽玛)
L * = 116 * Y ^ 1/3 - 16
...渴望知觉均匀性...紧密匹配人类对轻盈的感知。 -
维基百科
When converting from RGB to grayscale, it is said that specific weights to channels R, G, and B ought to be applied. These weights are: 0.2989, 0.5870, 0.1140.
It is said that the reason for this is different human perception/sensibility towards these three colors. Sometimes it is also said these are the values used to compute NTSC signal.
However, I didn't find a good reference for this on the web. What is the source of these values?
See also these previous questions: here and here.
The specific numbers in the question are from CCIR 601 (see the Wikipedia link below).
If you convert RGB -> grayscale with slightly different numbers / different methods,you won't see much difference at all on a normal computer screenunder normal lighting conditions -- try it.
Here are some more links on color in general:
Wikipedia Luma
Bruce Lindbloom 's outstanding web site
chapter 4 on Color in the book by Colin Ware, "Information Visualization", isbn 1-55860-819-2;this long link to Ware in books.google.commay or may not work
cambridgeincolor :excellent, well-written"tutorials on how to acquire, interpret and process digital photographsusing a visually-oriented approach that emphasizes concept over procedure"
Should you run into "linear" vs "nonlinear" RGB,here's part of an old note to myself on this.Repeat, in practice you won't see much difference.
RGB -> ^gamma -> Y -> L*
In color science, the common RGB values, as in html rgb( 10%, 20%, 30% ),are called "nonlinear" orGamma corrected."Linear" values are defined as
Rlin = R^gamma, Glin = G^gamma, Blin = B^gamma
where gamma is 2.2 for many PCs.The usual R G B are sometimes written as R' G' B' (R' = Rlin ^ (1/gamma))(purists tongue-click) but here I'll drop the '.
Brightness on a CRT display is proportional to RGBlin = RGB ^ gamma,so 50% gray on a CRT is quite dark: .5 ^ 2.2 = 22% of maximum brightness.(LCD displays are more complex;furthermore, some graphics cards compensate for gamma.)
To get the measure of lightness called L*
from RGB,first divide R G B by 255, and compute
Y = .2126 * R^gamma + .7152 * G^gamma + .0722 * B^gamma
This is Y
in XYZ color space; it is a measure of color "luminance".(The real formulas are not exactly x^gamma, but close;stick with x^gamma for a first pass.)
Finally, L* = 116 * Y ^ 1/3 - 16"... aspires to perceptual uniformity ... closely matches human perception of lightness." --Wikipedia Lab color space
这篇关于将RGB转换为灰度/强度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!