hi,
i found the following formula for calculating the luminance of a pixel for which i need an explanation,
luminance = r*76 + g*150 + b*29
i require the basic idea for scaling the RGB values in this way to calculate the luminance. is this a standard equation?because somewhere i saw something like this
luminance=R*0.3 + G*0.6 + B*0.1
can i use any scaling factor (making sure to keep G>R>B)?
Luminance of a pixel
Started by magneeto, Jan 09 2007 06:19 AM
2 replies to this topic
#1
Posted 09 January 2007 - 06:19 AM
#2
Posted 09 January 2007 - 06:58 AM
The weights are based on studies of the human eye which have shown that the sensitivity to red, green, and blue differs, therefore the luminance has different scaling factors for each color channel. More precisely, the equation should be:
luminance = 0.299*R + 0.587*G + 0.114*B (reference)
You can see that both of the equations you have posted are approximations to this - in the first, they multiplied the whole thing by 255 and rounded to the nearest integer (notice 76 + 150 + 29 = 255, so that's probably intended to give you luminance in [0, 255] from RGB in [0, 1]), while in the second they rounded to the nearest 0.1.
luminance = 0.299*R + 0.587*G + 0.114*B (reference)
You can see that both of the equations you have posted are approximations to this - in the first, they multiplied the whole thing by 255 and rounded to the nearest integer (notice 76 + 150 + 29 = 255, so that's probably intended to give you luminance in [0, 255] from RGB in [0, 1]), while in the second they rounded to the nearest 0.1.
reedbeta.com - developer blog, OpenGL demos, and other projects
#3
Posted 11 January 2007 - 04:06 AM
thank you. that was really helpful.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











