• Please use real names.

    Greetings to all who have registered to OPF and those guests taking a look around. Please use real names. Registrations with fictitious names will not be processed. REAL NAMES ONLY will be processed

    Firstname Lastname

    Register

    We are a courteous and supportive community. No need to hide behind an alia. If you have a genuine need for privacy/secrecy then let me know!
  • Welcome to the new site. Here's a thread about the update where you can post your feedback, ask questions or spot those nasty bugs!

Metrics for hue and saturation?

Doug Kerr

Well-known member
We often mention that chromaticity (one of the two major attributes of color) can be thought of in terms of two subordinate attributes, hue and saturation.

But if we wish to quantify color in that way (specify a color numerically), what metrics quantify hue and saturation? It tums out that there aren't any!

A while ago, in an article here, I discussed HSV and HSL color spaces, pointing out that any specific one is a transform of a certain RGB color space. (Or, the HSV and HSL color models are transforms - perhaps not precisely defined - of the RGB color model.)

One critic said he could not understand why (I) "seemed stuck in having to determine HSL values in RGB terms." (Well, gosh, that's how the guy that invented it saw it, and defined it!) He went on to imply that, if we had a particular color in mind, we could determine its H, S, and V coordinate without need to think of any particular RGB color space (or presumably using R, G, and B values as intermediate results).

That's not so, but that assertion gives me a great entry into the topic of this article.

There are a lot of things that suggest the assertion is not correct (or more accurately, isn't even meaningful). Here's one simple test before we move to serious work:

We have a color described by the HSV values 0, 0, 50. Since S=0, then the chroma (and the saturation) should be zero. This the color represented should be white Which white is that?

See the bottom for the answer.

A metric for hue

To first probe the credibility of the assertion, let's think only of one part of the matter - the HSV coordinate H (which we consider to essentially represent the "hue" of the color of interest). If the assertion is true, then we should be able to find the equations that define the relationship between h, the actual hue of the color, and H, the corresponding HSV coordinate.

But we soon find that this is a doomed errand, since there is no such parameter as h. That is, there is no standard numerical quantity that represents the hue of a color. (This is different from luminance, for which there is a standard definition.) No CIE color space, for example, has h as a coordinate. And there is no CIE definition of a "metric" for hue.

Now, we sometimes use the "next best thing", the concept of the "dominant wavelength" of a color. We can see the concept on Figure 1:

hue_saturation_01.gif


We see the CIE x-y chromaticity diagram, in which any point represents an explicit chromaticity. We are first interested in the hue of the color whose chromaticity is shown as point C1.

We draw a line from the point representing white (W) through the point of interest until it intersects the locus of spectral chromaticity (the "horseshoe"). We call the wavelength there the "dominant wavelength" of the color, and consider that to be a metric for its hue (h1 in this case).

But there are a few flies in the ointment.

We find one when we consider another color, C2. Here, the line does not intersect the horseshoe at all. It leaves the arena across the locus of spectral purples. By definition, there are no wavelengths associated with points on that line.

Or course, we could use the fractional distance of the intersection along that line to describe the hue in such cases. So we have a metric that works in units of wavelength for some cases and as a ratio in another. Not too cool.

Now, just what chromaticity do we consider "white"? Recall that there is no chromaticity that is inherently entitled to be called white.

In Figure 2, we see the result of choosing some other "white":

hue_saturation_02.gif


We see that now the indicated "dominant wavelength" is h1a rather than h1 - a dramatic difference. So we have a dramatically-different indication of the hue of the color C1.

Now, there are three different CIE chromaticity diagrams, x-y, u-v, and u'v'. If we do this exercise on each diagram, for the same color, and the same choice of "white", we will get three different dominant wavelengths - implying three different values of he.

So it does not seem credible that there is an inherent numeric metric that describes hue. (We could force an artificial one, though, by saying that it is to be measured on the CIE x-y chromaticity diagram, using CIE illuminant "E" as the white.)

But we can't convert from this to the HSV coordinate H. Why? Because H is defined in terms of the R, G, and B coordinates of the color, and those coordinates, for any given color, vary depending on the particular RGB color space we have in mind.

A metric for saturation

Now lets look into the matter of a numerical parameter for saturation. Again, we are hindered here in that the CIE (for example) does not give a quantitative definition of the attribute saturation.

As with hue, we use some pragmatic ways to fill that gap. A common one is seen on Figure 3:

hue_saturation_03.gif


We have our point of interest, chromaticity C. We draw a line from white, W (oh, boy, here's a problem already) through point C until it intersects the locus of spectral chromaticities. The color there (as we saw earlier) is considered to have the same hue as point C. And, as a "monochromatic", or "pure" chromaticity, we consider it to he ave highest saturation possible for that hue, which we may call 100%.

We then take the ratio of the distance k1 to the distance k2, and say that this (perhaps expressed in percent) is the metric for the saturation of the chromaticity C (and thus for any color that has that chromaticity).

Note that here the same notion is perfectly credible for "purples".

Now we can already see that there are two problems:

• It works differently is we choose a different "white".
• It works differently is we use q different chromaticity diagram.

Still, if we wanted to, we could define h as the ratio of k1 to k2, measured on the CIE x-y chromaticity diagram, with the point "W" being CIE illuminant E.

In other situations, we may use the outlook illustrated on Figure 4:

hue_saturation_04.gif


The principle here is the same as before, except now the "perimeter" (considers to be the locus of all colors whose saturation we call 100%) is the boundary of the chromaticity gamut for the color space we have in mind (!). In effect, we compare the "chroma" (distance from W) of the color of interest with the chroma of the most-saturated color we can represent in the color space.

Now, which of these gives the "right" answer? There is no right answer, since there is no inherent definition of a metric for saturation.

A challenge

Now. back to the assertion that for any color there is a unique description in terms of H, S, and V (not dependent on the choice of a specific underlying RGB color space, and without using R, G, and B values as intermediate results). I would like to see a description of how that transformation might be made. At the least, I would like to hear a rationale and "workflow" for deriving the necessary equations that transform a color's description, for example, in terms of the CIE coordinates X, Y, and Z, into the coordinates H, S, and V. At best of course would be the set of equations themselves.

Best regards,

Doug



Answer: the reference white of the RGB color space upon which this particular HSV color space is predicated.

Why is some particular RGB space involved? Because any given HSV space is defined in terms of the coordinates R, G, and B (presumably as pertains to some particular RGB color space).
 

Doug Kerr

Well-known member
This is further to the assertion, made by a critic of one of my articles here, that an HSV color space can represent a color without reference to any underlying RGB space.

This is course would imply a definition of the coordinates of that system different from any I have seen, but I don't get around much.

If the assertion is true, than an unavoidable corollary is that any given set of H, S, and V values would always imply a certain color (that is, a color with a certain set of CIE x, y, and Y values).

If the assertion is true, then we find that Photoshop bungles its use of the HSB color model (another name for the HSV model).

For example, is we have in effect in Photoshop the sRGB color space, and enter into the color chooser this HSB representation:

H=0°, S = 100%, V=100%

then Photoshop will set as the current color. It only reveals that color to us in terms of its coordinates in the current (sRGB) color space. That color turns out have the chromaticity of the "R" primary of the sRGB color space (which has certain CIE x and y coordinates - no need to clutter this note up with the actual numbers).

If we enter this HSB representation:

H=0° [actually irrelevant in this situation], S=0%, V=100%

then Photoshop will set as the current color a color which turns out to have the chromaticity of the defined white point of the sRGB color space (CIE standard illuminant D65), which has certain CIE x and y coordinates.

Next, we will establish the ProPhoto color space as the working space in Photoshop,
and again enter into the color chooser this HSB representation:

H=0°, S = 100%, V=100%

Then Photoshop will set as the current color a color which turns out have the chromaticity of the "R" primary of the ProPhoto color space (which has certain CIE x and y coordinates - not the same is in the prior case, for the sRGB "R" primary).

If we enter this HSB representation:

H=0° [actually irrelevant in this situation], S=0%, V=100%

then Photoshop will set as the current color a color which turns out to have the chromaticity of the defined white point of the ProPhoto color space (CIE standard illuminant D50), which has certain CIE x and y coordinates - not the same is in the prior case, for the sRGB white point, D65.

Now how has Photoshop come to bungle this? Because it proceeds on the basis that the coordinates of an HSB color space are functions of some particular RGB-model color space, as defined in the published definitions of the HSV/HSB color model/space (at least the ones I have seen).

Yet a corollary of the assertion spoken of here is that a given set of H, S, and V/B coordinates represents a specific color - not a set of R, G, and B coordinates that represent different colors depending on the specific RGB color space in effect.

Perhaps the designers of Photoshop have in mind a wholly different definition of the coordinates of an HSL (HSB) representation than do I - or than did the original developer of the HSV coordinate system.

Now lets consider a color space that truly is not defined in terms of an underlying RGB-model representation, L*a*b.

If in Photoshop we first set the working space to sRGB, and enter into the color chooser these L*a*b* coordinates:

L*=50, a*=15, b*=-20

Photoshop sets as the current color a color it only reports to us in terms of its coordinates in the current (sRGB) color space:

R=132, G=111, B=153

Here, we will determine the actual color that represents in the CIE xyY color space (I will only report the chromaticity coordinates):

x=0.290, y=0.257

Now, we set the working space to ProPhoto, and enter into the color chooser these same L*a*b* coordinates:

L*=50, a*=15, b*=-20

Photoshop sets as the current color a color it only reports to us in terms of its coordinates in the current (ProPhoto) color space:

R=110, G=95, B=131

As before, we will determine the chromaticity of the actual color that represents in the CIE xyY color space:

x=0.289, y=0.255

Almost exactly the same as before (small discrepancies are expected since all the values are rounded to integers).

So we see that there are color spaces we use that do represent colors absolutely, and without reliance on any underlying RGB-model space.

It's just the HSV (HSB) ain't one of them.

Best regards,

Doug
 
Top