From: wft@math.canterbury.ac.nz (Bill Taylor) Newsgroups: sci.math Subject: Re: Sorting Colors - How? Date: 23 Nov 1994 01:25:05 GMT |> >What I want to do is take a palette of colors,(0-255 say), in RGB format |> >and re-arrange them in such a way that they _appear_ sorted/grouped |> >by their _appearance_. ie Blue-ish/Green-ish/Red-ish groups etc. |> |> Color is a 3-dimensional property. Right. I responded to this on sci.physics a little while ago; but again... |> The Munsel color sphere is a nice way to display them. Yep, it's good. It has re-appeared in many different guises and under other names. My version of it is appended below. |> If you can get by with implying a lightness/darkness axis not |> being displayed, a good 2-d representation is to use the a*, b* values |> (produces a fin shaped display if all of color space is spanned). You can take any appropriate 2-d slice of the double cone below. |> Color is |> much more complicated (and non-linear) than most people suspect. And how! Here we go then... -------- Nice post on colors by Matt McIrvin! mcirvin@scws37.harvard.edu (Matt McIrvin) writes: |> Though the retina has |> receptors which correspond to broad ranges sort of centered around |> red, green, and blue, there's a lot of processing in the visual cortex |> that divides color space in rather different ways, Yes indeed; and there's also a *lot* of pre-processing that goes on in the optic nerve itself, at the retina end! This is well-known for shape/pattern detection problems, and I think applies to color vision as well, especially when boundary regions are involved. (Hence those simple optical illusions whereby the same color looks quite different when surrounded by one border or by a differently-colored border. Theres's no way we can "get them" to look the same, no matter how certainly we know they are!) |> (The science and art of color only begins with physics; a lot of it is |> neurophysiology and psychology! How very true. And easily forgotten. |> A better way to do this would be to transform the colors into a |> coordinate system that is closer to the way we normally think about |> colors, such as HLS, in which the coordinates are hue, luminance |> (brightness, more or less), and saturation (which measures how vivid |> or gray the color is) ... |> ... pink is a lighter, less-saturated red, brown is a |> range of darker, less-saturated yellows, oranges and reds, and so on. All very nicely put. And the grays are totally desaturated any-hues, of varying luminance; black being totally dark gray, and white totally light gray. I've always been intrigued by the two standard painters' ways of ordering colors, and their "mathematical" relationship. (And actually, insofar as colors are physical, I think the math is genuine, not pseudo.) Both ways have one dimension being hue; arranged naturally in a circle from red through orange, yellow, green, blue, purple, & back to red. The other two dimensions are then Cartesian and Polar versions of the same colors! The HLS mentioned above, is the polar, with the origin as the pure color, the radius as the saturation (actually its complement), and the angle as the luminance. The angle is one quadrant only, and the radius is in [0,1]. Then there is the cartesian style, HWB, Hue-%White-%Black, (more natural for commercial paint mixers!) The pure hue is at the origin again, and the amounts of black and white mixed in are along the two co-ordinates. To get it just right, we must flatten the quarter-circle arc of total de-saturation (100% black & white in various proportions) into a straight line, and turn the diagram on its side. Here it is all pictured for hue yellow; (and if you disagree with some of my color words just insert your own; and this same slice could probably also take beige, sandy, khaki...) <--- de-saturation --- black |\ ___ | \ |\ | \ | \ % of black added | | \ \ | | brown \ \ | | \ | dark \ luminance gray tan | | \ | | \ | mid blonde \ | gray yellOw <---(O is the origin as usual!) V | buff / | / | / | fawn / / pale / / gray cream / % of white added | / | / | / |__ | / | / |/ white This is the luminance/saturation ( = black/white) slice for hue = yellow. To make the polar/cartesian correspondence stand out, the left-hand line of grays should really be a left-bulging arc, of course. But (i) this would be terrible in ascii, and (ii) all the other hues can now be neatly added in by joining them all along the gray-line, so as to get a nice little bi-conical booklet of colors, with pages from yellow through orange, red etc and back to yellow, (with as many hue gradations as suits you). So color is thus naturally presented in 3-dimensional cylindrical co-ordinates! Either as HLS, (circular hue crossed polar shades), or as HBW, (circular hue crossed cartesian b/w mixes). I've always thought this polar/cartesian correspondence was particularly cool! ------------------------------------------------------------------------------- Bill Taylor wft@math.canterbury.ac.nz ------------------------------------------------------------------------------- "We're pushing back the frontiers of knowledge!" "Yes; but from which side?" -------------------------------------------------------------------------------