How can a 3-color system be mapped to a linear one?

When on the computer, colors are based on percentage of reg, green and blue.

But lots of systems put the colors in a linear order, like color temperature, wavelength, or Hue/Saturation/Luminance.

How can hue, as a linear concept, ziz-zag over a 3-axis color space?

You’re sort of mixing navel oranges and tangerines here.

Color, as defined in various “3D” spaces is a combination of the color’s value, saturation and brightness.

Grossly simplified:
Value is the color itself - red, green, orange, etc
Saturation is a value ranging from gray (no color) to full-strength
Brightness is a value ranging from black to white.

There’s a decent introduction to color theory here.

Color temperature is a different subject entirely. It’s the “color” of white. This explains it better than I can.

mmmmm… navel oranges and tangerines…

Anyway to add to gotpasswords, wavelength is a quality of monochromatic light. Color is generally made up of a mixture of different wavelength light. There is no wavelength for “pink,” for example - pink is made up of some blue light, some green light and a bit more red light.

Is that right? I thought that you could just average out the wavelengths/frequencies of the individual light colors to a single wavelength/frequency, just as you can with sound waves.

Here a link describing non-spectral colors

http://www.animalbehavioronline.com/whatiscolor.html

These are colors that do not appear in the spectrum.

I am not sure what you are saying here about sound. But chords (for purposes of this discussion two or more frequencies at the same time) can be differentiated from a tone that is the average of the component frequencies. What do you mean by averaging?

I can assure you it’s far, far worse than all that. I’ve been to a very entertaining lecture on colour theory as well as having plenty of experience with manipulating colours on computer.

What you’ve got to get clear first is that colour in general is not a mix of red, green and blue on any other choice of three primaries. Computers use red, green and blue because those are the colours of the phosphors on screen. It is convenient for them. Other indexing systems are used for other reasons of convenience, and not all have three parameters.

Hue, saturation, lightness (HSL) is used because it is quite intuitive for humans. CMYK is used because it gives good printed results and it’s cheap to use black ink rather than mixing colours. Hexachrome is a six-index system which can give very subtle “photorealistic” colour for high-quality commercial print, but is not used as a matter of course because it is complex and expensive to use (you can’t represent it accurately on a computer - you need to look at printed samples for comparison).

However, all these are artificial mixing systems with various strengths and weaknesses. It may be worth noting that humans can perceive around 3 million different colours and shades. A 3-index, 8 bit per index system (e.g. 24 bit RGB colour on a computer) can represent nearly 17 million, but the range of colour represnted (the gamut) is much smaller than human vision.

Moving away from computers, what we see as colour is just different frequencies of electromagnetic radiation. We perceive a certain section of the spectrum. Other creatures can see outside this range. Most colours we see are mixtures of different frequencies, with laser light being pretty much the only common exception. It is possible to represent some mixtures of frequencies as a single other frequency and for them to look identical when viewed directly. However, this is very much down to human perception and when a mixture and a single colour looks the same to one person, it may not look exactly the same to another.

Colours that cannot be represented accurately as one frequency are ones from the opposite end of the spectrum. E.g., mixing red and blue light gives what we perceive as magenta. However, you cannot produce magenta light with a laser.

Ah, color theory, one of my favorite topics.

RGB: Computers display color on monitors, at least, by combining red, green and blue monochromatic light. This is because the human eye (usually!) has three sets of color-sensitive receptors; these receptors have their peak stimulation in the red, green, and blue regions of the spectrum, respectively. Computers (and televisions) take advantage of this and generate trichomatic light that will be perceived the same as a monochromatic (or polychromatic, in some cases) light source of the same color. Because of the way human vision works, there is a certain mixture of monochromatic red light and monochromatic green light that will look exactly the same to you (unless you’re colorblind or a tetrachromat) as a monochromatic yellow light source.

There are color of light that humans can see that cannot be represented by the computer’s RGB color space. Generally, this is because those colors have more red, blue, or green in them than your monitor can put out. This problem is most noticable in the blues and violets because the blue intensity of a standard monitor is not capable of going very high, relative to the green or red. There are also colors that cannot be well-represented because they have fundamental wavelengths shorter than that of television blue or longer than that of television red. Some of them can be approximated, but most of them are impossible because it’s not possible to emit a negative amount of monochromatic light. (I’ll explain this in a subsequent post or in my LiveJournal if requested.)

HSV (or HSL): The hue, saturation, value color space is just another way of representing the same three values for each color as the RGB space is. HSV is a modified cylindrical mapping of RGB space. Basically, first we squish the “color cube” of RGB space onto an upside-down cone (with black at the point, white at the middle of the base at the top, and the primary colors red, green, and blue 120 degrees apart on the circumference of the base). We then define “value” as the height of the color, saturation as how far the color is away from the center of the cone, and hue as how far along the circumference from red that color is. HSV is not a very useful colorspace, however, because of the lack of “perceptual uniformity”: small changes in one coordinate do not always make consistently small changes in perceived color.

Luminance is a variation on value that weights green more than red and red more than blue, according to an empirical formula developed by the NTSC when they were developing the standard for color television. This weighting reduces, but does not eliminate, perceptual disuniformity.

There are other colorspaces, such as CIE XYZ, CIE Luv, and CIE Lab that seek to remedy either the “gamut” problem (colors that cannot be represented) or the perceptual nonuniformity problem (small changes in numbers not leading to similarily small changes in perception). Lab is currently the best approximation we have. The formula for computing Lab is complex and also depends on your choice of “white point”, a separate issue that I will not get into right now.

Frequency and wavelength: Visible light has wavelengths ranging from about 380 nanometers (violet) to about 720 nanometers (red). The color of a monochromatic (single color) light source is determined by its wavelength. Each wavelength in this range will stimulate the three color receptors in the eye in different ways, which is how we perceive different colors. Monochromatic colors often look very strange to us (usually, “harsh” is the word used) because most light sources in nature are polychromatic. Since light consists of vibrating photons, frequency and wavelength are tied together by the physics of a vibrating object. Frequency is just the speed of light divided by the wavelength. It is more normal to talk of wavelength when discussing visible light.

Color temperature: Color temperature is related to wavelength through what is called “blackbody radiation”. When you heat an object up, it emits radiation in a spread of frequencies that depends on the temperature. The hotter the object, the higher the frequencies it emits at. At about 2000 kelvins or so (that’s about 3100 degrees Fahrenheit) blackbody radiation will appear dimly red. As the temperature gets hotter, the perceived color goes through red, orange, yellow, yellow-white, white, and then blue-white at around 10,000 kelvins. Above 10,000 kelvins the the peak of the blackbody emission spectrum moves into the ultraviolet and the perceived color becomes more bluish as the lower red and green colors begin to taper out.

I’ll add links and further comments if people want them. I have to run just now.

KellyM, thanks for the god explanation. I am quite familiar with RGB and feel comfortable using it and I understand the limitations of monitors which cannot do colors outside their limits. Let us assume R, G & B can each range from 0 to 100. Can you provide a formula which would give us H, S & L? That would help me understand and visualise. I believe L would be the average of R, G and B (Or weighted average for NTSC) But what would H and S be?

In Irfanview you can adjust the colors of the GIF palette and you get a square with Hue along the top (red - green - blue - red) and saturation in the vertical (full color at the top, grey at the bottom) after selecting those you get a vertical slide at the right to adjust luminance.

In Photodeluxe you get a square with hue along the top and luminance along the side but no adjustment for saturation.

I am trying to mathematically relate HSL with RGB.

Oooh, I’m going to get really picky here, be warned…

Strictly speaking, the monitor phosphors aren’t monochromatic.

I’m not aware of any humans with >3 cone classes…

In fact, they don’t! It’s the way in which the signals from the cones are combined that’s the key here…

=‘Metamerism’.

Some years ago, researchers were working on displays using lasers in place of the phosphors. This could expand the gamut of displays greatly. Interesting work, but I don’t know what became of it.

As you say, luminance is ‘supposed’ to be a measure of perceptual brightness, although it isn’t quite right. There are other, better, measures of perceptual brightness.

Lab is arguably worse than CIECAM and derivatives.

See, said I’d be picky…

sailor, yes, there are formulas. The one for RGB to HSV is not very pretty analytically, as it is not smooth.

The best example I can give is in C source code, from the open-source image editor The Gimp. The functions have obvious names. You can browse the source for this function here: libgimpcolor/gimpcolorspace.c.

Boldface Type, there are documented tetrachromats. This occurs in some women who have one, but not both of one of genes for the color vision defects known as protanomaly or deutanomaly. These genes are carried on the X chromosome, so women have two of them. Because of random X chromosome deactivation, a woman who has one of these genes on one of her X chromosomes will have two types of L (protanomaly gene) or M (deutanomaly gene) receptors, with somewhat different spectral response functions than the norm. These women can distinguish monochromatic yellow from bichromatic yellow. The additional color discrimination of the tetrachromat is probable minimal at best, but has been demonstrated in the laboratory.

Another tidbit I recently came across is that a fourth reception range has been identified, in the near UV, which is usually absorbed by the cornea. This has come out in studying visual performance changes in people who have had their corneas removed to treat cataracts. It is not yet clear whether these are additional stimuli ranges of existing receptors, or an entirely new receptor.

I’m not familiar with CIECAM; it’s too new to have filtered down much to the noncommercial domain that I live in. So much of the newer work in this area is badly encumbered by intellectual property issues.

Oops. Substitute “deuteranomaly” for “deutanomaly” in my last post. Silly fingers.

That’s very interesting, thanks. I’d heard of individual differences in the peak responses of cone receptors, but had not heard of human tetrachromats per se. Do you happen to have a cite handy? Ta.

Yes, it doesn’t help that there there are competing colour appearance models (and colour difference equations) springing up like mushrooms. They are published in the lit, but keeping up to date is beyond the call of duty for people with a passing interest. I think the Munsell system remains something most people can easily understand, and use to get a handle on colour representation. A Google would probably chuck something up.

Female tetrachromats: http://www.redherring.com/mag/issue86/mag-mutant-86.html

Googling “female tetrachromat” should also be profitable.

Boldface Type, posts like yours which are just picking on what other say are really not very helpful as they tend to muddy rather than clarify.

>> Strictly speaking, the monitor phosphors aren’t monochromatic.

We could write a book about this but for the purposes of this thread considering them as monochromatic is a reasonable simplification.

>> I’m not aware of any humans with >3 cone classes…

How about fewer than 3 color-sensitive receptors? daltonism?

>> these receptors have their peak stimulation in the red, green, and blue regions of the spectrum, respectively
>> In fact, they don’t! It’s the way in which the signals from the cones are combined that’s the key here…

Not really. Again, you are not really helping. You can see a graph in the following page.

Fair enough. Sorry.

It would be a very short book … but again, in the context of this thread, fair enough. I accept your point.

Fewer, yes. Well known.

Yes, really. The graph you link to illustrates my point somewhat - that the ‘R’, ‘G’ and ‘B’ cones do not have peak responses at focal ‘red’, ‘green’ and ‘blue’ colours. Refer to any reasonable perception textbook for an explanation. E.g., From Cornsweet (1970), p.217 ‘It is important (…) to point out that the red-absorbing pigment (…) would not look red.’ He goes on to explain this in respect of the ‘blue’ and ‘green’ cones, too.

But otherwise you are right; I’m probably muddying the waters (not in the sense of the blues chap, you understand), and I’ll exit stage left.

Sailor: Here’s a web-based color converter (RGB/HSL/CMY/CMYK/HEX):

http://www.lxhome.de/skript/colors.html

Please note that doing RGB to CMY/CMYK is a black art that is highly dependent on the specific inks and paper you are using as well as the printing process employed (i.e. inkjet, laser, offset, litho, etc.). Most cheapie converters make unwarranted assumptions (mainly, either no correction for dot gain or a simple correction that will probably not work) that will yield inappropriate CMY/CMYK numbers.

You have been warned.

toadspittle, thanks for the link. I am trying to get an intuitive feel of how the conversion works and that should help after I study it.

Even better (since you’re so hard-core):

http://130.113.54.154/~monger/hsl-rgb.html