Jump to content
  • Advertisement
Sign in to follow this  
Jason Doucette

RGB luminosity

This topic is 4993 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have seen in numerous places that the luminosity of RGB can be computed like so: l = 0.299 * r + 0.587 * g + 0.114 * b After an attempt to find the source of these values, thanks to Google's new variable number search feature, I stumbled upon this page: http://lists.gnu.org/archive/html/groff/2001-10/msg00181.html The original values given are as follows: 0.298912 0.586611 0.114478 However, the article goes on to say that this standard (Rec 601-1) is old, and you should use the new ITU standard: 0.222015 0.706655 0.071330 Does anyone know if it has been upgraded since then?

Share this post


Link to post
Share on other sites
Advertisement
The currently used standard is ITU-R BT 709-5. I couldn't tell you the exact values though, because the standard isn't available for free (isn't it sad, when they make you pay money to get access to a standard ?)

Anyway, you should realize that all these values are approximations. They will change from one display to the next, and from one human to the next. The most accurate way to compute them, is by using the ICC profile of the currently active display. But if all you want to do, is converting a colour value to a greyscale value, then pretty much any value triple will do: Rec 601, Rec 709, whatever. Heck, sometimes even (r+g+b)/3 works fine.

Ultimately depends on your application.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yann L
The most accurate way to compute them, is by using the ICC profile of the currently active display.
Could you provide some more information on this? I've found the documentation for Win32 color profile functions, render intents and so forth. What specific elements should I be looking for, and how should I employ them in computing an accurate RGB intensity or greyscale?

Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by Oluseyi
Quote:
Original post by Yann L
The most accurate way to compute them, is by using the ICC profile of the currently active display.
Could you provide some more information on this? I've found the documentation for Win32 color profile functions, render intents and so forth. What specific elements should I be looking for, and how should I employ them in computing an accurate RGB intensity or greyscale?

Thanks.

The basic idea is as follows: What we have are the linear low dynamic range RGB components we write into the framebuffer. What we want is the subjective luminosity the human eye perceives the combination of the three primaries at, as displayed by the screen. Once we have this value, we can replace the RGB tripple by a greyscale value that will produce the same subjective luminosity feeling.

The linear RGB components are converted by two distinct non-linear systems in the process: the display (RGB phosphor, TFT, etc) and the human visual system. We need to transform the linear RGB function by the non linear curves of each subsystem, and integrate the intensity of the final wavelength spectrum as perceived by the human eye.

First, the emission spectrum of the display is computed for a given RGB value. That's basically done by applying a colour correction using the ICC profile of the display. There is no real accurate ICC intent representing the physical emission spectrum, but the perceptual intent is closest.

The second step is converting the corrected RGB to a spectral power distribution, and weighting the display emission spectrum by the psycho visual CIE curves for human vision. Note that some CM systems might already do that, if you specify the perceptual render intent. The result is a spectrum as perceived by the average human eye. To get the equivalent CIE luminance (Y), we need to integrate over the perceived visual spectrum from approximately 400nm to 700nm.

All this assumes that the viewer has an "average standarized" visual system, ie. is not colour blind. Special weighting curves exist for different types of coliur blindness, that can be optionally used to accomodate users with visual colour weaknesses.

Of course, all that is considerably more complex than a simple Y = 0.212671 * R + 0.715160 * G + 0.072169 * B. As I said, it ultimately depends on your application, whether the complex route is worth it, or not.

BTW, the Windows CMS system isn't very good in terms of quality, at least compared to Apples Color Sync. If you want something better and less bloated, I'd recommend Little CMS.

Share this post


Link to post
Share on other sites
Human vision is not that simple. First, responces is not linear. Second, there is four channels in eye, one for low intensity light. Third, display is also non-linear. So, i'd consider that in "0.222015 0.706655 0.071330", everything except "0.2 0.7 0.07" is pure speculation. And that even "0.2 0.7 0.07" is not precise. It is even more speculative than if you would measure average height of humans in inch, and then convert to centimeters with "micron precision" digits. Really, to me precision in 0.222015 looks like complete BS. I just hate hi-tech bullshitting and idiotism. If it would be 0.2,0.7,0.07 , i would use it. Or if it would be the only standard and it would be absolutelly critical for compatibility. But as it is no0t the only standard... i'd just make it be user-defined if somebody cares about it. If nobody cares, 0.2,0.7,0.07 will do.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dmytry
So, i'd consider that in "0.222015 0.706655 0.071330", everything except "0.2 0.7 0.07" is pure speculation.

Actually, it is not. The emission spectrum of standarized CRT phosphorus can be measured very accurately. The human vision system, although slightly different from one person to the next, is actually pretty constant with its response to various wavelengths. The fourth channel in human vision (scotopic vision) is irrelevant for daylight or artificial light, since it saturates and is automatically disabled by the brain. It's only used at very low intensities, when normal colour vision doesn't work anymore. There is some overlap ("mesopic vision"), and while CGI research is done in this field, it can largely be ignored for anything that deals with larger light intensities.

Back to the chromacity weights. You're thinking in low dynamic ranges only. When you consider how large the dynamic ranges can get in global illumination, a simple 0.01 weight in a colour channel can make a huge colorimetric difference after exposure has been applied. So, keeping the full precision is very important when dealing with HDR illumination.

But I agree, if it's only about creating a greyscale image, the value doesn't really matter. I'll quote myself again: "it ultimately depends on your application".

Share this post


Link to post
Share on other sites
Uhhh. I thought it was clear i'm is talking about relative intensities, right? Indeed, absolute 0.01 can make difference (like 0 versus 0.01), but relative 0.01 can't.

In eye, we have some exposure function for every channel (also, channels even overlap, damnit). We can say that visibille intensity is given by sum of that functions (and even that is not very correct). We need that
fr(grayscale)+fg(grayscale)+fb(grayscale)=fr(R)+fg(G)+fb(B)

Also, that function is ,roughly speaking exponential, for same reason as why photofilm response is exponential. Decay of chemicals is like exp(-exposure*lightness), and exponential response is very common thing in biology.

If you gonna to say that response of eye can be approximated by that linear thing so with grayscale=R*k1+G*k2+B*k3 this equatio0n is correct even with 10% precision (at lightness range of display, that is, at range where brightest is at least 200 times brighter than darkest) i just don't know what to reply :( . It's you are thinking in terms of extremely small range, something like 90%..110% , where responses can be approximated by linear.

The problem is not that eyes of different people is "slightly different", it's that eyes if ALL people *is not linear*. It's you are thinking in terms of extremely small range, something like 10% of intensity, when response can be approximated by linear.

Also note that i even assume that gamma of display is taken into account, and usually it isn't.

Also, colors of displays is very unprecise. It worth nothing that spectrum of phosphours is precisely known - response curves, as always, aren't exactly linear.

Really, this numbers is complete speculation after first digit. Not because eyes is different, but because eyes is non-linear. Very non-linear. And this approximation, is, indeeed, just approximation of non-linear thing by linear, that have *inherently small precision*, and using some extra digits from **** will not make it be any more precise.

The only reason to use that standard is if it would be needed for compatibility. But because there's more than one standard, it will be just better to make weights in conversion be user-defined.

These numbers is just like five-digit precise "wood on wood friction".[grin]

Share this post


Link to post
Share on other sites
Dmytry, you are mixing up radiometry with photometry.

The Y = a*R + b*G + c*B equation is a radiometric equation, treating brightness as radiant flux (in Watts). While display emission spectra are not linear (that's what ICC profiles are for), they can be approximated by a linear combination of weights, if each chromatic primary is assumed to be monochromatic. If you need more precision, ICC profiles can take the non-linearity of the display emission spectrum fully into account.

So, when treating light brightness as radiometric unit, and the primaries as monochromatic, then the equation above is prefectly correct. Note, that the response curve of the human eye is not yet taken into account. For simple low dynamic range colour to greyscale conversions, it doesn't need to be, because the difference won't be visible anyway. But for high dynamic range, they will make a large difference.

The integration over the CIE display curves transform the radiometric radiant flux to a photometric luminous flux measured in Lumen. And here again, the non-linearity of the human eye is fully taken into account. It's just that this step is usually not required for low dynamic range applications.

So in conclusion: there is absolutely no speculation involved in the weights of this equation. They are perfectly accurate for a theortical "perfect phosphorus" - and in practice, where we don't have these "perfect" displays, ICC profiles correct for it.

Share this post


Link to post
Share on other sites
Quote:

The Y = a*R + b*G + c*B equation is a radiometric equation, treating brightness as radiant flux (in Watts).

i (and guess, not only i) have been confused by bold portion of
Quote:

They will change from one display to the next, and from one human to the next.

and other posts, after that I thought you were talking about visible lightness, and that values looked rather like responses of eye (most sensitive to green). If that is radiometric equation, then it doesn't take human eye into account, and should not take human eye into account, and therefore does not depend to human, or to color blindness/weakness. And yes, then it could be precise.(but, certanly not to fifth digit (heck, if you'll tell somebody who really works with colors that displays have precision to fifth digit, he will just laugh. It at best have +/- 1% )

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!