Sign in to follow this  

RGB luminosity

This topic is 4690 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
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
Quote:
Original post by Dmytry
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).

The linear equation Y = a*R + b*G + c*B is radiometric per-se. Rec 709 et al try to adjust the factors a,b and c in order to accomodate the visual response curve for the three monochromatic primaries, basically making it photometric. But this is just a rough approximation, as I have mentioned several times. If you want good precision, then you need to use the combination of ICC profile and CIE weighting. Still, the decimals are not "speculation", they're the mathematical closed form solution of the psycho visual model, when applied to three monochromatic primaries. Keep in mind that Rec 709 wasn't designed to compute the perceived intensity (that's what the CIE curves are for), but it was designed to specify electrical signal levels for HDTV.

Quote:
Original post by Dmytry
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.

I said that there were special CIE curves for colour weaknesses - that's a difference, since they are in fact non-linear.

Quote:
Original post by Dmytry
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% )

Keep in mind, that these equations are not only used for your typical CRT display. They are just as well used for eg. laser imaging devices, which can in fact be much more precise than 1%. It is important to keep the precision, in order to make the equations usable on any device and image generation technology.

Share this post


Link to post
Share on other sites
I know that this values is solution of some equation. But all coefficients in equations is known with certain precision. Really, if my height is 180 cm +/- 5mm , and i convert it to inches, if i keep fifth digit precision, that digits will be just speculation anyway, right? Created to mislead people that it is something uber precise. Same there. We have some equation where almost all coefficients are +/- some precents. And then, we magically get five-digit precise result from it, heck.

Do you know *what* really is fifth-digit precision? It's 0.000008 cm^2 effective area of dirt on 1 cm big lens, that's it. It is extremely hard (if possible) to, e.g. measure electrical current with that precision. For example, i know that projection systems inherently can't have that precision because opacity of air depends to themperature.[grin][lol]

edit: and laser imaging devices have completely different spectrum.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dmytry
I know that this values is solution of some equation. But all coefficients in equations is known with certain precision. Really, if my height is 180 cm +/- 5mm , and i convert it to inches, if i keep fifth digit precision, that digits will be just speculation anyway, right? Created to mislead people that it is something uber precise. Same there. We have some equation where almost all coefficients are +/- some precents. And then, we magically get five-digit precise result from it, heck.

Not in this case. All involved quantities (except for the psycho visual curves, which are fuzzy by nature) are defined well beyond the fifth decimal.

Quote:
Original post by Dmytry
Do you know *what* really is fifth-digit precision? It's 0.000008 cm^2 effective area of dirt on 1 cm big lens, that's it. It is extremely hard (if possible) to, e.g. measure electrical current with that precision.

Electrical current can be measured down to the single electron. Although this is obviously irrelevant for this specific application, one have to take into account, that many radiometric equations have applications far beyond computer imaging. There are many circumstances where such precision is required (for example in high energy and particle physics simulation software).

Quote:
Original post by Dmytry
For example, i know that projection systems inherently can't have that precision because opacity of air depends to themperature.[grin][lol]

You do realize, that certain extensions to ICC profiles (for example for very high fidelity image beamers) can take environmental parameters such as air temperature, pressure, dust density, etc, into account ? Those are important to minimize chromatic abberations, when projecting on very large surfaces, especially outside.

Quote:
Original post by Dmytry
edit: and laser imaging devices have completely different spectrum.

Irrelevant. That's what ICC profiles are for - to standarize the chromaticities of devices with totally incompatible spectra. Just look at printers, they don't even have the same colourspace.

BTW, this is going heavily offtopic, and we should stop this discussion. If you're interested in continuing it, I'd suggest opening a new thread.

Share this post


Link to post
Share on other sites
Quote:

Not in this case. All involved quantities (except for the psycho visual curves, which are fuzzy by nature) are defined well beyond the fifth decimal.

And then, we have well-known "average precision" sindrome[grin]. Do you know that if one thing is inprecise (psycho visual curves), result is as inprecise?

(as about "well beyond the fifth decimal" i doubt even single value is measured with that precision, but anyway.)

Quote:

Electrical current can be measured down to the single electron.

Electrical charge (not current) can be measured down to single electron. You can measure average *very small* current during some relatively big amount of time (seconds) with that precision, by counting every electron. But nobody really does it, and it is practically irrelevant.
And electron counters, too, could make mistakes (miss electron, or count non-existing electron) much more often than 1 electoron per 100000 .
And almost every automated measurement boils down to measurement of current. It is definately possible to count photons, or electrons, but it can't be done fast or reliably. It is VERY hard to measure ampers of current with five-digit precision, or even microampers.
Quote:

There are many circumstances where such precision is required (for example in high energy and particle physics simulation software).

Exactly. In that areas such precision is required.

I have no idea what argumentation could be used against man deeply believing that vision systems could have 5-digit precision of colors. Eye doesn't have that precision, damn. No human sense except counting have such precision.

Quote:

You do realize, that certain extensions to ICC profiles (for example for very high fidelity image beamers) can take environmental parameters such as air temperature, pressure, dust density, etc, into account ? Those are important to minimize chromatic abberations, when projecting on very large surfaces, especially outside.

Of course, with large surfaces, you have to take that into account because it's affects result by _several_precents_.

[Edited by - Dmytry on February 12, 2005 8:59:06 AM]

Share this post


Link to post
Share on other sites
Well, this is definitely going too far offtopic.

Anyway, whether you like it or not, those values are internationally accepted standards. If you use different values, or truncate them, then your results will not be comparable or reproduceable by any other standarized system on the planet. There is a reason for the standarization of such conversion weights, and I would strongly recommend to use them.

Share this post


Link to post
Share on other sites
Dymitry
Quote:

everything except "0.2 0.7 0.07" is pure speculation

You'd have problems if you'd use 0.2 0.7 0.07.
0.2 + 0.7 + a MUST equal 1. In your example you'd have darker image than original.

I would have another problem. It's difference between CRT and LCD monitors. Do anyone have an experience with 24bit colors vs color depth used on LCD monitors?

Share this post


Link to post
Share on other sites
Quote:
Original post by Raghar
I would have another problem. It's difference between CRT and LCD monitors. Do anyone have an experience with 24bit colors vs color depth used on LCD monitors?

Your displays' ICC profile should take care of all that.

Share this post


Link to post
Share on other sites
Quote:
Original post by Raghar
Dymitry
Quote:

everything except "0.2 0.7 0.07" is pure speculation

You'd have problems if you'd use 0.2 0.7 0.07.
0.2 + 0.7 + a MUST equal 1. In your example you'd have darker image than original.

ops. actually i assumed it is "renormalized" anyway (divided by sum of 'em)... then, 0.22,0.71,0.07

Share this post


Link to post
Share on other sites

This topic is 4690 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this