By ypnos

2009-03-26 19:39:07 8 Comments

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.


@Myndex 2019-05-20 05:15:29

What is the source of these values?

The "source" of the coefficients posted are the NTSC specifications which can be seen in Rec601 and Characteristics of Television.

The "ultimate source" are the CIE circa 1931 experiments on human color perception. The spectral response of human vision is not uniform. Experiments led to weighting of tristimulus values based on perception. Our L, M, and S cones1 are sensitive to the light wavelengths we identify as "Red", "Green", and "Blue" (respectively), which is where the tristimulus primary colors are derived.2

The linear light3 spectral weightings for sRGB (and Rec709) are:

Rlin * 0.2126 + Glin * 0.7152 + Blin * 0.0722 = Y

These are specific to the sRGB and Rec709 colorspaces, which are intended to represent computer monitors (sRGB) or HDTV monitors (Rec709), and are detailed in the ITU documents for Rec709 and also BT.2380-2 (10/2018)

FOOTNOTES (1) Cones are the color detecting cells of the eye's retina.
(2) However, the chosen tristimulus wavelengths are NOT at the "peak" of each cone type - instead tristimulus values are chosen such that they stimulate on particular cone type substantially more than another, i.e. separation of stimulus.
(3) You need to linearize your sRGB values before applying the coefficients. I discuss this in another answer here.

@denis 2009-03-27 12:16:22

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 screen under 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 may or may not work

cambridgeincolor : excellent, well-written "tutorials on how to acquire, interpret and process digital photographs using 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" or Gamma 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.)


L* = 116 * Y ^ 1/3 - 16

"... aspires to perceptual uniformity [and] closely matches human perception of lightness." -- Wikipedia Lab color space

@iamantony 2013-02-03 08:04:40

Y = 0.2126 * R + 0.7152 * G + 0.0722 * B - Wikipedia (

@user1668969 2018-03-13 13:45:05

is all this really necessary, human perception and CRT vs LCD will vary, but the R G B intensity does not, Why not L = (R + G + B)/3 and set the new RGB to L, L, L?

@Bill Feth 2018-06-10 22:48:45

Simply averaging all three R,G,B primaries treats them as perceptually equal, which is not the case for the human vision system.

@ypnos 2009-03-26 21:54:23

I found that this publication referenced in an answer to a previous similar question. It is very helpful:

It shows 'tons' of different methods to generate grayscale images with different outcomes!

@rmmh 2009-03-26 19:48:55

Here's a paper on how these numbers (or similar ones) were derived:

@Bob Pickle 2016-08-18 01:04:03

These values vary from person to person, especially for people who are colorblind.

@twerdster 2011-01-30 00:18:18

Heres some code in c to convert rgb to grayscale. The real weighting used for rgb to grayscale conversion is 0.3R+0.6G+0.11B. these weights arent absolutely critical so you can play with them. I have made them 0.25R+ 0.5G+0.25B. It produces a slightly darker image.

NOTE: The following code assumes xRGB 32bit pixel format

unsigned int *pntrBWImage=(unsigned int*) pointer..;  //assumes 4*width*height bytes with 32 bits i.e. 4 bytes per pixel
unsigned int fourBytes;
        unsigned char r,g,b;
        for (int index=0;index<width*height;index++)
            fourBytes=pntrBWImage[index];//caches 4 bytes at a time

            I_Out[index] = (r >>2)+ (g>>1) + (b>>2); //This runs in 0.00065s on my pc and produces slightly darker results
            //I_Out[index]=((unsigned int)(r+g+b))/3;     //This runs in 0.0011s on my pc and produces a pure average

@damix911 2013-01-13 07:30:15

0.3 0.6 0.11 don't add to 1. Wikipedia seems to suggest 0.30 0.59 0.11.

@twerdster 2016-10-13 11:06:03

True, but the only result of them not adding to 1 will be a very slight change in intensity. The proposed method of 0.25,0.5,0.25 does add to 1 but it wouldnt matter if it didnt. It is an optimization so giving up a tiny bit of accuracy is a reasonable tradeoff.

@Myndex 2019-05-20 02:09:32

@twerdster Neither set of coefficients are correct. .3,.6,.11 is the old NTSC standard, not sRGB/Rec709 (which is what the web and most computers use). And your 0.25,0.5,0.25 is not a reasonable tradeoff — B is only 7% of luminance, you're wrong by 347%. The coefficients for sRGB/r709 (after linearization): Rlin * 0.2126 + Glin * 0.7152 + Blin * 0.0722 = Y These spectral weightings are derived from human spectral perception. You can't just jam in whatever numbers you want for convenience and hope to be accurate. You need to linearize sRGB and then apply the correct coefficients.

@ToolmakerSteve 2019-11-27 10:02:39

If you are in a situation where divide is too expensive, an approximation that uses a single multiply with shifts and adds is: 0.11111111 * ((G + (G<<1) + R) <<1) + B). This is equivalent to (2*R+6*G+B) / 9) or 0.222 R + 0.666 G + 0.111 B. Before going to production, compare to an accurate formula for various test cases.

@Brian Campbell 2009-03-26 19:51:20

Check out the Color FAQ for information on this. These values come from the standardization of RGB values that we use in our displays. Actually, according to the Color FAQ, the values you are using are outdated, as they are the values used for the original NTSC standard and not modern monitors.

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Mapping RGB data to values in legend

20 Answered Questions

[SOLVED] Formula to determine brightness of RGB color

  • 2009-02-27 19:19:31
  • robmerica
  • 307464 View
  • 389 Score
  • 20 Answer
  • Tags:   image colors rgb

49 Answered Questions

[SOLVED] RGB to Hex and Hex to RGB

1 Answered Questions

[SOLVED] removing background 'noise' from signal images (RGB)

3 Answered Questions

1 Answered Questions

[SOLVED] How to apply grayscale image mask to a rgb image in java

2 Answered Questions

1 Answered Questions

[SOLVED] How to show grayscale intensity image in its RGB form without merging the channels?

  • 2017-04-09 07:35:04
  • Payam Khoshkenar
  • 169 View
  • 0 Score
  • 1 Answer
  • Tags:   matlab rgb

2 Answered Questions

[SOLVED] Why gamma-correction is applied to RGB instead of YUV or similar?

2 Answered Questions

[SOLVED] Opencv L*a*b* to RGB conversion produces grayscale output

  • 2015-02-08 10:22:42
  • Angel Arturo Ramírez Suárez
  • 2015 View
  • 0 Score
  • 2 Answer
  • Tags:   c++ opencv rgb cielab

Sponsored Content