I found this function for RGB to Gray scale converter at this kind:

RGB to grayscale

This example converts an image with RGB channels into an image with a single grayscale channel.

The value of each grayscale pixel is calculated as the weighted sum of the corresponding red, green and blue pixels as:

Y = 0.2125 R + 0.7154 G + 0.0721 B

Copy to clipboard

These weights are used by CRT phosphors as they better represent human perception of red, green and blue than equal weights. 1

Also at Matlab site said about :


rgb2gray converts RGB values to grayscale values by forming a weighted sum of the R, G, and B components:

0.2989 * R + 0.5870 * G + 0.1140 * B

These are the same weights used by the rgb2ntsc function to compute the Y component.

The coefficients used to calculate grayscale values in rgb2gray are identical to those used to calculate luminance (E'y) in Rec.ITU-R BT.601-7 after rounding to 3 decimal places.

Rec.ITU-R BT.601-7 calculates E'y using the following formula:

0.299 * R + 0.587 * G + 0.114 * B

So, i like to know why difference value and how many standard exist in this function type?



There are different color spaces. Each of them has different coefficients for calculating gamma-corrected luma from gamma-corrected RGB values. You have listed coefficients for calculating luma according to ITU-R BT.709, ITU-R BT.601 and NTSC color spaces. There are many others as well, like BT.2020 used in consumer TVs for Wide Color Gamut.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.