Slashdot Mirror


Determining Color Difference Using the CIELAB Model?

Colour Blind asks: "I am working for a not-for-profit organization developing a website for kids. I am attempting to develop a method for testing if two colours (as defined by R, G, and B values [0-255]) are adequately different to be visible on top of each other. So far I have tried many things but this is the one that, by all accounts, should work: I have converted from RGB to (CIE)XYZ using a 3x3 matrix transformation. From here I have used three more equations to convert to CIELAB colour. I have then calculated the distance between the two colours in question in CIELAB colour space. The results are not correct: there are pairs of colours that are quite far from visible that yield the same difference as colours that are plainly acceptable for visibility. Any suggestions?"

199 comments

  1. Solutions by thecarson · · Score: 0, Offtopic

    HolyColor does just this. Check it out, but it's only for Linux.

    1. Re:Solutions by Hal-9001 · · Score: 2, Informative

      There's nothing on this page having anything to do with color. Googling for "HolyColor" didn't turn up anything either.

      --
      "It take 9 months to bear a child, no matter how many women you assign to the job."
    2. Re:Solutions by Anonymous Coward · · Score: 0

      I found it. Installing now, dork. Mod parent up!

  2. difficult problem with much research by glyph42 · · Score: 2, Informative

    There is a large body of research on perceptually uniform color spaces. Last I checked no one had an accurate model, though many have tried. Look on citeseer or something, or google for that matter. Best of luck!

    --
    Music speeds up when you yawn, but does not change pitch.
    1. Re:difficult problem with much research by Wavicle · · Score: 5, Informative

      Hear hear!

      This is a complex problem and I think a lot of the answers I'm reading on this topic center around a misconception on a lot of people's part about the difference in luminance perception and chrominance perception. The key issue is:

      The eye is most sensitive to luminance changes in GREEN.
      The eye is most sensitive to chrominance changes in BLUE.

      Thus if you are trying to determine at what point the eye will say "hey there is a block of a different color on top of that one", blue is going to be an important part of your color model since while your eye isn't so good at picking up how bright a blue is, it is very sensitive to the relative shade around the blue wavelength something is.

      So if you are trying to do a 3-space transform and distance and finding that colors which are linearly close to each other in CIELAB space are perceptually very different, it is very likely because it is a color in a space where the human eye is more perceptually sensitive. You are going to get "dead areas" of the model where the eye is not so good at viewing differences, and active areas where in a small space there seem to be quite a few different colors because the eye is perceptually sensitive in that area.

      This is the reason you see odd patterns in color changes in a rainbow. You are seeing the relative sensitivities of your eye to pick up colors. Color perception is decidely non-linear and doesn't even fit a nice equation.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    2. Re:difficult problem with much research by gmiller123456 · · Score: 1

      The main problem is that there is no mathematical representation of how the eye will perceive a particular color. This is more of a psychology question than a math question.

      You may have better luck with a fuzzy logic solution in which you rate which how well certain combinations work. But, even still, this will change from person to person.

      As a side note, when I go to the optomitrist he shows me two images: one with red lettering on a green background, the other with green lettering on a red background. He then asks me which one appears clearer, and it's obviuosly one or the other. Then he flips a lens, asks the question again, and now its clearly the opposite of what it just was.

      So I think you'll find the problem is much, much more difficult than you expected.

    3. Re:difficult problem with much research by spitzak · · Score: 2
      CIELab space is only perceptually uniform for very small distances. Ie a tiny distance would be considered "about equal in difference" anywhere in the space.

      But over long distances it is an integral of all these small "about equal" values and that adds up to a very large variation in perceived distance, so it is not perceptually uniform for long distances.

      In fact I suspect that such a perceptually uniform space could not be represented in three dimensions.

      A better approach may be to take XYZ (which I think does represent the response of the cones in the human eye) and do a lot of math on the two XYZ sets to deliver an "amount different" value. Don't think about spaces, your goal is to produce this single number, losing the actual colors.

  3. Color Blind! by hkhanna · · Score: 1, Interesting
    This is an interesting experiment, and it could even have implications in the game programming world. I used to experiment with that kind of stuff (RGB palettes, etc...) but then stopped after I couldn't tell the differences between any of the colors.

    I went to the doctor only to find out I was color blind and that explained why I could only see three colors on a rainbow. It's sad, I know, but true.

    --

    Think nothing is impossible? Try slamming a revolving door.
  4. Color blindness by Steven+Reddie · · Score: 1

    Will the system account for red/green color blindness?

    1. Re:Color blindness by SkywalkerOS8 · · Score: 1

      And how about tetrachromats as mentioned here? How would it be affected to take them into account.
      For those too lazy to click the link, tetrachromats are woman who see in RYGB(instead of RGB like most of us). They have a fourth type of sensor in their retina that has a peak sensitivity to wavelengths of light that are in-between red and green(aka yellow). This means while we can't tell the difference between a piece of paper lit by a light that has a yellow filter in front of it and light that is a combo of a red light and green light, they can tell the difference.

    2. Re:Color blindness by SoupIsGoodFood_42 · · Score: 1

      Yes, not to mention that any designer that puts red text on a green background or visa versa shouldn't be designing anyway ;)

    3. Re:Color blindness by BWJones · · Score: 4, Interesting

      Yeah so this was interesting as there have been tetrachromats discovered in other primates (monkeys other than humans), so it was reasoned that it might be possible to find tetrachromacy in humans.

      The advantage that hyperdimensional color perception has over traditional trichromacy it a better ability to discriminate hues or different colors. Therefore a tetrachromat could be considered to be at a certain advantage when it comes to color discrimination. This obviously has not been important to our evolution but it is for some species as birds and turtles see a world we can only imagine with some birds seeing from ultraviolet into the visible spectrum and turtles seeing a world rich with color. For instance, if you were to imagine a turtle sitting in a pond with the water as still as glass and the sun setting on the horizon making everything (the sky, land and water) red and orange and yellow, the turtle sitting in the water would be able to pick out a frog sitting on a log with discrimination that we could never hope to approach.

      --
      Visit Jonesblog and say hello.
    4. Re:Color blindness by Shiny+Metal+S. · · Score: 2
      Therefore a tetrachromat could be considered to be at a certain advantage when it comes to color discrimination.
      But while using our RGB monitors and TV the colors would seem flat to him, like RG (without blue) picture would be flat to me. This could be quite inconvenient, however still less than a greyscale pictures to us.
      --

      ~shiny
      WILL HACK FOR $$$

    5. Re:Color blindness by BWJones · · Score: 2

      But while using our RGB monitors and TV the colors would seem flat to him, like RG (without blue) picture would be flat to me. This could be quite inconvenient, however still less than a greyscale pictures to us.


      True, but up till just recently, evolution had nothing to do with RGB monitors and TV. And if they do end up having an influence on evolution I am sure that TV influence would not be for the better. Besides, there is a world outside of the RGB gun. Yes?

      Seriously though, RGB monitors and the technology that they use is pushing 80 years old. Adaptive technologies and composite individual pixels will make these issues less of a problem.

      --
      Visit Jonesblog and say hello.
    6. Re:Color blindness by Shiny+Metal+S. · · Score: 2
      True, but up till just recently, evolution had nothing to do with RGB monitors and TV.
      No, it had not. But RGB monitors have everything to do with evolution. Their 3-D color space is simply the minimum to fool the human eye.
      And if they do end up having an influence on evolution I am sure that TV influence would not be for the better. Besides, there is a world outside of the RGB gun. Yes?
      I think you misunderstood me.
      --

      ~shiny
      WILL HACK FOR $$$

    7. Re:Color blindness by Dynamoo · · Score: 1
      Absolutely, it doesn't matter what modelling system you use 4-5% of your visitors will have different colour perception from the "norm".

      This is a great page - Ocular Times.

      The bottom line is dichromats and anomalous trichomats (such as myself) really screw up complex color models, and ultimately the best designs tend to be those that concentrate on providing a really high contrast, and never, ever use colour as the primary way of conveying information (e.g. press the GREEN button for this, RED button for that).

      It's quite easy to test a color scheme to see if it's readable across all types of colour perception, simply load a sample into your favourite paint or photo editing package and test the colours with each of the RGB elements removed in turn.. then try it in monochrome to check that it's still readable. If you try this with Slashdot you'll find that the colour scheme is great :)

      Now if only those b*stards who make kit with Red/Orange/Green LEDs took the same amount of care the world would be a happier place!

      --
      Never email donotemail@WeAreSpammers.com
    8. Re:Color blindness by AYeomans · · Score: 1

      BT Exact Technologies recently published a paper on designing for colour blindness. More information and colour palettes are on "Safe web colours for colour-deficient vision".

      --
      Andrew Yeomans
  5. Color Blind Test by fk319 · · Score: 1

    I have taken visual tests where they have colored circles, next to other colored circles. There is a number hidden in the circles.
    The test is for certian types of color blindness.
    Perhaps somebody know the name of the test and you may fine it helpfull.

    1. Re:Color Blind Test by eli867 · · Score: 1

      I believe you are talking aboutthis test.

      Although I think it's highly questionable as to how accurate this could possibly be using uncalibrated computer monitors...

    2. Re:Color Blind Test by Dr.+Mutex · · Score: 1

      It was accurate for me (I'm red-green blind). The way my opthamologist explained it to me years ago, the difference in appearance is dramatic. I don't think the monitor being a little off would make much difference. Of course where your eyes are concerned, you want to check with an M.D. I don't think too many people get past the First Grade without this being diagnosed. Coloring green dogs is a dead giveaway. (btw, my dad still has a green ceramic dog I made him in second grade. Looks fine to him too. :)

      --Placed here to annoy people who turn off sigs

  6. Ask /.? by ryants · · Score: 2, Insightful
    --

    Ryan T. Sammartino
    "Ancora imparo"

  7. Just eyeball it.... by Anonymous Coward · · Score: 0

    If you have enough time to write programs to do this kind of thing, you probably have the time just to look at two colors and figure it out for yourself.

    1. Re:Just eyeball it.... by blkros · · Score: 2

      My sentiments exactly. Nothing is better than the human eye for differentiating colors.

      --
      Damnit, Jim, I'm an anarchist, not a F@#$!^& doctor!
    2. Re:Just eyeball it.... by HughsOnFirst · · Score: 1

      No, no, no, no, no! ( that is an odd number of the word no, for those who keep track)
      Different people are going to have different results. The same person is going to have different results depending on environment and physiological state.

  8. Well, step 1 ... by Anonymous Coward · · Score: 1, Informative

    Is to make sure you're doing your transformations in logspace.

    1. Re:Well, step 1 ... by Anonymous Coward · · Score: 0

      > Is to make sure you're doing your transformations in logspace.

      For that CIE scheme, that is a very good point.
      YUV RBG is linear, but CIE has a big hairy
      non-linear eqn.

    2. Re:Well, step 1 ... by catmaker · · Score: 1, Funny


      Step 3... profit.

      --
      status is failure. status is failure
    3. Re:Well, step 1 ... by Profe55or+Booty · · Score: 1

      we haven't decided what step 2 is yet.

      --
      sig - .
  9. Read this relevant document by saforrest · · Score: 5, Informative

    A friend of mine wrote a paper on this topic:

    Limitations of Colour Management.

    1. Re:Read this relevant document by Anonymous Coward · · Score: 0

      WRONG ANSWER.

      Certainly it's Chainsaw Linux?

  10. Re:This is relevant why? by Anonymous Coward · · Score: 0

    This is a computer science / vision problem. This is not specific to the organization nor is this a programming problem, running a Debugger will not get you anywhere.

    Maybe if you did your computer science homework you would know that.

  11. Perceptually equal color spaces by Joe+Decker · · Score: 5, Insightful
    None of the standard Photoshop, et al color spaces is designed to produce perceptual equivalence, perception is just too complex.

    In addition, it sounds like you're hoping to test whether things are sufficiently perceptually different on people's monitors. The sad news is that the variation between different monitors, between LCDs and CRTs, between different brightness and contrast settings, between different phosphor technologies, differences in how long the monitor has been warmed up, and differences in the aging of the phosphors mean that no two monitors will actually produce the same color from the same R, G and B equivalents, and you'll get different distinguishabilities for different colors on different monitors.

    As a nature photographer, I have to jump through hoops, including hardware sensors for detecting the output of my monitor, to get anything like reproducable color out of my own equipment. It's just a difficult problem, I'm afraid.

    1. Re:Perceptually equal color spaces by greenrd · · Score: 1
      And then there's the perception end: there are a whole variety of color blindness syndromes affecting a significant minority of the population - the most common being red-green color blindness.

      [Also, it seems I'm not the only one who has problems distinguishing indigo in a rainbow.]

  12. -1 Ignorant by Anonymous Coward · · Score: 0

    I would have moderated you "-1 Ignorant" if I could, you'll just have to deal with "-1 Troll"

  13. Try the Value in HSV instead by "Zow" · · Score: 4, Interesting

    I think the key in picking colours for any website is that they have have a difference of at least X in brightness (the V in Hue-Saturation-Value unless I'm sadly mistaken - I'm not an expert in this area), where you should be able to determine X experimentally. Any decent color picker (such as those in Gimp or Photoshop) will allow you to jump between RGB or HSV. The reason I think this is the way to go is that a decently large percentage of the population (at any age) is colour blind, so while you or I may easily be able to see the difference between a blue and green, or a green and red, at the same brightness, some people (particularly males), just can't.

    That should take care of you for making the site usable. At that point, the choice of which light or dark colors you use for what becomes purely stylistic (again, I'm just a stupid computer scientist - I'm sure someone with a stronger HUI, marketing, or fine arts background might have a stronger opinion on what colors are used for what).

    -"Zow"

    1. Re:Try the Value in HSV instead by keesh · · Score: 3, Interesting

      That works quite well, but only at higher saturations. At lower saturations involving too many greys, the rule quite often fails. Having one high and one low saturation is also pretty good. The advantage of this is that it almost totally avoids the colour blindness problem if you stick to one hue.

      The HSL colour space isn't a very good mapping, though. Things like CIE are better representations of how we really see things.

    2. Re:Try the Value in HSV instead by sfraggle · · Score: 5, Interesting

      I have to agree with this. I am the author of Text Mode Doom and I hit a problem along these lines during development: the RGB value itself is not particularly useful when trying to find a numerical value for a particular "colour" that the human eye perceives. In text mode doom I was faced with the problem of mapping the particular colour value to a corresponding text colour, of which I was limited to a small value (under 16). I solved the problem by converting the RGB values into HSV and then assigning text colours to the real colours based on their hue. The results I found with this were quite impressive

      --
      were you expecting to see a sig here? perhaps you'd rather see the inside of an ambulance!
    3. Re:Try the Value in HSV instead by Mister+Transistor · · Score: 1

      I think perhaps you may have miscalculated something. The HSV color space scale is equivalent to CIE but expressed differently. It's like comparing temperatures in Fahrenheit vs. Celsius.
      If you have given color, it will map to an absolute value in either color space scheme. That value will be different, of course, but should be consistently repeatable.

      --
      -- You are in a maze of little, twisty passages, all different... --
    4. Re:Try the Value in HSV instead by Anonymous Coward · · Score: 1, Interesting

      I wrote a little tool to generate bg and fg colours for terms and text edit windows( gvim) from a desktop background xpm. I found that hsv worked for a limited volume of its colour space, but not its entire volume. The problemn is that the HSV space is not a very good mapping. In fact I am rather suprised that it even exista. I have thought about converting to CIELAB, but it is actualy better suited for print ( i.e. converting back to CMYK). Lets face it, CRTs are just plain obnoxious. Colour pairs that should work don't and pairs that should not sometimes do. The fault is not with RGB, but the mechanics of the monitor. BTW I was getting ready to work on an alternative mapping to HSV that would more acuratly map the responce of the eye. The problem is that what I have done so far does not yeild three 0 to FF numbers. My colour theory book was written by a guy named Kuhn ( I think) he is one of the leading experts in this field. It might be well worth reaserching what he has published resently.

    5. Re:Try the Value in HSV instead by autopr0n · · Score: 2

      I think the key in picking colours for any website is that they have have a difference of at least X in brightness

      The key to picking colors for a website is LOOKING AT THEM

      --
      autopr0n is like, down and stuff.
    6. Re:Try the Value in HSV instead by mystran · · Score: 2, Interesting
      Maybe something like:

      Take the H, S, and V values of both colors. Then calculate a difference for each of them like: |h2 - h1| and |s2-s1| and |v2-v1|

      Use Hue so that the min-value and max-value are the same (effectively to create a circle and find the smaller arc between the points on in) Then do something like dH*dS*dV possibly with some constant weights and the result shoul should be larger when the difference is larger.

      For this to give useful numbers H, S and V should probably be a float between 0 and 1.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    7. Re:Try the Value in HSV instead by thogard · · Score: 1

      In 1987 when I first got to play with a real 24 bit color system (a sparc 1!), I wrote a program that would display 1/12 of the colors at one time. It turns out that if you do this you quickly find that about 8 million of the 16 million colors appear brown. There are less than 250 colors that appear orange and when shown independently most people would describe at least 1/2 of thouse as brown.

      My solution was to build a HSV->RGB analog converter and treat the 3 bit planes as H S or V.
      The result is that you now have closer to 16 million useful colors.

    8. Re:Try the Value in HSV instead by "Zow" · · Score: 2
      The key to picking colors for a website is LOOKING AT THEM

      While your reply seems intuitive, my point was that what you and I perceive when we look at the screen is not necessarily what someone else, whose vision is not quite as acute as ours, may see. In my first job out of school I worked with this one guy who is one of the best developers I've ever known, and he was legally blind. It was really insightful to take something to him asking, "What do you think of this (UI) design?" and have the response be something along the lines of, "It's all a blur. Is there any way to zoom in, or separate the elements?" That sort of thing just hadn't occured to me. I won't say that I consider it for everything these days (I've chosen the colours on my personal website more for effect than accessability), but if I've got something professional to put out the door, I certainly do what I can.

      -"Zow"

  14. Think this through... by Anonymous Coward · · Score: 2, Interesting

    Have you been able to demonstrate that the small difference seen between two contrasting colors is due to a flaw in the CIELAB model? If so, perhaps you can publish a paper on the subject. Otherwise, what evidence do you have that your program is actually doing the right thing? For example, CIELAB appears to use polar coordinates. Are you sure that you are treating 0 and 2*PI as being the same value?

    Also, you have not demonstrated a need for such an evaluation function to exist. Is this because the site designers have a problem being able to choose readable colors? Perhaps if these people cannot select a good color scheme, you need new designers.

    1. Re:Think this through... by Anonymous Coward · · Score: 0

      Boy you are an idiot. How you got modded to a 2, I'll never understand. You are just a smart assed punk with a demonstrated inability to think. If you knew anything about what your spouting off about, you would know how usefull a tool that could take a set of colors and reduce them to usable color pair would be. A tool like this could also be used to automatical generate usable colors for dynamicaly created containt. The questioner was asking for input as to possible flaws in his methodology. He was not stating that there is a problem with the CIELAB model. If you did what he did you would see what he saw. Part of this is due to the mapping of RGB to the CRTs color space, and in part to the methods used to convert RGB to other color spaces.

    2. Re:Think this through... by spitzak · · Score: 2

      CIELab is not polar coordinates, the a and b are perpendicular axis that describe a location in the "hue" plane (L is the lightness). Hue is sometimes done as an angle but not here.

    3. Re:Think this through... by baxissimo · · Score: 1

      Actually there would not be much of a paper in exposing the flaws in the CIE's L*a*b "perceptually uniform" color space. The limitations were known to the folks who designed it. It was intended to be a color space which was *nearly* perceptually uniform, but at the same time computationally efficient to transform into and out of on whatever hardware they had back when it was defined. They had to cut corners to come up with something that didn't require a supercomputer (of that era) to put to practical use. So yes there are regions where it strays pretty far from the ideal of perceptually uniform.

  15. Usenet? by Lord+Omlette · · Score: 0, Offtopic

    groups.google.com

    --
    [o]_O
    1. Re:Usenet? by Anonymous Coward · · Score: 0

      > groups.google.com

      Isn't it sad that a company can effectively "own" UseNET?

      Blarh!

  16. It depends on the difference and how it's approach by Anonymous Coward · · Score: 2, Interesting

    Note, IAANR (I am a neurobiology researcher), but I deal mainly with ion channels so take this with an appropriately sized grain of salt:

    Your ability to tell the difference between two colors (or light intensities to bring back the classic experiments) depends on how you approach the limit of perception (or differentiation in this case). Classically, if you start where you can not perceive a difference between to intensities, and increase the difference, your threshold for difference will be lower than had you started when you could tell the difference between the two intensities and gradually decreased this difference. It seems that color differences should follow the same rules as light intensities. Also keep in mind that we're more sensitive to differences in shades of blue, IIRC, due to overlaps in the sensitivity ranges of long, medium and short cones. So, these are probably among the causes for you observations.

  17. Re:This is relevant why? by keesh · · Score: 3, Interesting

    Automated colour scheme generation. Let's face it, most people (myself included) can't generate a decent colour scheme to save themselves. Having a program create scheme suggestions automatically is extremely useful (blatant plug: check my sig for my own attempt at doing this) for non-artists.

    There are a load of tricks for generating colours which usually work well together; however, the hue rotations trick sometimes generates totally unreadable combinations (mainly with bright colours). Having an additional check would be extremely useful.

    Anyway, it could be that you're good at graphics, in which case good for you. Just give the rest of us time to catch up :)

  18. I am confused by wessideg · · Score: 0, Offtopic

    I too fail to see the use of posting such a story on a site of this nature. But it does sound interesting.

    1. Re:I am confused by t · · Score: 1
      This is a News for Nerds site. Thus if you do not consistently find the news articles interesting then you must not be part of the target nerd audience.

      Move along, nothing to see.

  19. Re:lp by wessideg · · Score: 1

    props given!

  20. Re:This is relevant why? by j2demelo · · Score: 1

    Though he is probably writing software, his question is about solving a problem. I don't see where you get "programming structure" from.

    This question seems relevant to me, because of the increasingly visual nature of the WWW. Getting more information on this particular topic could be very handy in the field of usability. Too much software (especially on the web) is really lacking in that department.

    Since I suspect there are many software developers/engineers among the slashdot crowd, I think this question does matter.

  21. Land's Two Color visual perception work by mbone · · Score: 4, Interesting

    Edwin Land (yes, the founder of Polaroid) did work in human color perception, where he showed that two colors could used to create an apparent full color image.

    The important things are our visual expectations, as well as the relative intensity of parts of the scene. I can remember a demo from Land where two projectors sufficed to give a full color scene. If part of the image was abstracted, it appeared to be black and white ! This implies that a combination of two colors can, under certain circumstances, appear to be the same as a different combination of three colors. I would suspect that this effect would have to be considered in the vision tests described in the original posts.

    A Michigan State U. report on the Land work is available, as is a lot of more recent work, such as this paper by Kobus Barnard.

  22. Complex issue by wex · · Score: 3, Interesting

    There are a number of critical factors in this process that you haven't told us. The issues of display devices, gamma, and implementation details all play an important role in your ability to visibly distinguish between two colors.

    What sort of monitor are you using? Have you correctly callibrated the display? What software are you using to display the colors? How does this software deal with display gamma? Other important details include the brightness of the surrounding environment, other windows and such on the screen which can distract the eye and interfere with your visual processing of the colors.

    If you haven't already read the books and web pages by Charles Poynton, they cover all the details. Color issues always seem simple, but actually this is an extremely complex and subtle issue. Also, people's ability to visually distinguish color varies quite a bit. A surprisingly large percentage of the population is color blind to at least some portion of the spectrum. Also, display devices vary widely in their ability to correctly display different colors.

    Anyway, to sum it all up, I'd be really surprised if you can use any sort of theory to predict whether you can visually distinguish between different colors. Even with correctly callibrated equipment, and experienced researchers, I doubt that your problem is easily answered!

    Best of luck,

    Daniel Wexler
    www.flarg.com

  23. Color blindness by BWJones · · Score: 3, Informative

    Another issue that should be considered is that approximately 5% of humans are red-green color blind. There are other forms that are more rare, but in designing web-sites it is common enough that it should be taken into consideration.

    See http://www.visibone.com/colorblind/ for useful color information specific to web-site design.

    --
    Visit Jonesblog and say hello.
  24. Not a chance... by YuppieScum · · Score: 2

    Not only do the differences between individual monitors - make, model, batch, age, time used, etc - affect the state of the phosphor and so the displayed colour, so do brightness, contrast and ambient lighting. That's not even taking LCD panels into consideration.

    Then you've got the fact that not only does everyone perceive colour in a different way, but some people are colour-blind! I myself am unable to distinguish between the standard yellow & green used in 4-colour mode on the BBC Micro from so long ago - the last census stats I saw indicated that 8% of the population have some form of colour-blindness.

    I think you really need to re-think your web-site design - after all, what's wrong with black on white?

    --
    This sig left unintentionally blank.
    1. Re:Not a chance... by Anonymous Coward · · Score: 0

      We're not adapting our web-sites so your less-attuned eyes can bathe in the wealth. Maybe a colour blind theme, but I'm not working any harder because someone is optically-impaired.

    2. Re:Not a chance... by Anonymous Coward · · Score: 0

      and how does that differ from the yellow and green in the 2 or 16 colour modes?

    3. Re:Not a chance... by YuppieScum · · Score: 2

      Two colour mode is black and white.

      16 colour mode may have been the same, but in the games I remember playing in 4-colour mode, the difference between yellow and green was the only time it made a... difference.

      --
      This sig left unintentionally blank.
    4. Re:Not a chance... by lkeagle · · Score: 1

      Black and White is ONE-color mode... We're not talking about palettes here, we're talking about dimensions (or more/less specifically, degrees of freedom) in color-spaces. Two color dimensions are often referred to in printing terms as 'duotone' images, because they only need to mix two colors of ink to print. What the colors are specifically depends on what the primary colors in the image are.

      The '4-color' computer displays you are referring to is the classic 'CGA' graphics palette. White, Black, Ugly Cyan, and Uglier Pink were the four colors you had to choose from. Anything dealing with higher colors, and you're probably talking about an 'EGA' palette, which indexes 16 colors to use from a palette of 8red*8blue*8green=512 total colors.

      ~Loren

  25. See also: by paynter · · Score: 1

    Sorry, I have sigs turned off.

    But re. automated colour scheme generation:

    Paul Lyons at Massey University (google is your friend) also describes ways for CS people to fake it - though from the presentation I saw, many "harmonious" colour combinations are not high-contrast, which seems to be what the question is about.

    1. Re:See also: by Anonymous Coward · · Score: 0

      here

      But it's win32 only! Noooooo! Shoot the heretic! And it's some dodgy artistic license thing, not GPL'ed!

      Quick, -1, flamebait!

      Ahem...

  26. Some useful links... by Hal-9001 · · Score: 5, Informative
    ...for people who are wondering what this is all about:
    • The CIE color space: A pretty decent introduction to what the CIE color space is
    • Color FAQ: I haven't read through this, but it seems to be a more extensive coverage of color and how it's much more than RGB, HSV, or CYMK.
    The short version is that all the different primary color systems--RGB (red-green-blue), CYMK (cyan-yellow-magenta-black), HSV (hue-saturation-value)--can represent some, but not all, of the colors visible to the human eye. Even specifying colors by the wavelength of the light emitted or reflected covers only a small subset of colors--in fact an even smaller subset than any of the primary color representations. The CIE system identifies colors by an XYZ coordinate system, where X, Y, and Z are artificial primary colors that span the full range of colors visible to the human eye.
    --
    "It take 9 months to bear a child, no matter how many women you assign to the job."
    1. Re:Some useful links... by keesh · · Score: 2

      Whilst we're on the karma-whoring links...

      This is an excellent introduction to colours on computers, complete with (working) algorithms for conversion.

    2. Re:Some useful links... by Anonymous Coward · · Score: 0

      I'd think that the only way to exactly specify every color (such that it doesn't depend on knowledge of the mechanism of actual color perception) would be to express it as a sum of wavelengths contained, i.e. define a function f(x) where x is defined over the range of visible wavelengths and the value of the function describes the intensity for wavelength x.

      Obviously the function would only be defined for points...and the amount of data for some colors would be too much to be handled in practice.

      Or am I just totally confused?

  27. Re:Perceptually equal color spaces (addition) by Joe+Decker · · Score: 2, Insightful

    Oh, just to make things even more difficult, two colors which are quite perceptually distinct may still make poor colors for text legibility. Try reading bright red text on a bright green, equal-intensity background. (Even if you're not red-green color-blind.) I suspect without evidence that text legiblity is more strongly related to luminosity differences than to perceptual difference metrics.

  28. There are some subtle aspects by Ezubaric · · Score: 3, Informative

    Are you doing it pixel by pixel? Sometimes pixels are not discrete color units, in which case you might want to reconsider your algorithm. For example, if you have a mosaic effect from newspaper you've scanned in, pixels are going to mirror the little newspaper specks of color introduced by the printing process. Maybe you want to have some sort of averaging method?

    Porison and Wandrell adapted CIELAB color models to account for the quirks of monitors. You need to have information on how far away people sit from the monitor, the resolution, the size, etc., but it's actually quite good. Here's a MATLAB implementation by Zhang at Stanford.

    One problem I had when I was working with this is that the pixels were not lining up correctly. Try overlaying the images and the CIELAB error to make sure your results are sensible.

    --

    ----------
    I am an expert in electricity. My father held the chair of applied electricity at the state prision.
    1. Re:There are some subtle aspects by Anonymous Coward · · Score: 0
      It's Poirson and Wandell, actually. Wandell is an expert in color perception; interested people should check out his book and/or papers.

      Unfortunately, comparing two colors when they overlap, is very different than comparing them when presented one after another. Even the non-linear models that produce "perceptually uniform" color coordinates (using some sort of "distance" measure, may not be adequate for the task. Perception of color is a VERY hard problem to model...

      btw. the reason for the movie links above, is because both (as well as Dave Brainard) wanted to get research funds, I believe...

  29. Simple Method by Anonymous Coward · · Score: 0

    You can't simply look at the difference between two colors and expect it to be meaningful. For example, the human visual system is much more atuned to variations in brightness/intensity than actual color.

    This is the reason that JPEG, MPEG, etc. Get away with downsampling the chrominance channels. Not only do the UV(CrCb) channels in most compression get downsmapled to half the vertical and horizontal resoulution, they also tend to be quanticize(SP!) at higher values.

    In short, the simplest thing to do would be to compute the intesities of the 2 colors in question using a formula such as I = R * 0.59 + G * 0.30 + B * 0.11.

    Then difference the intensities. Larger the difference, the easier to see.

  30. Quick info on color differences by nmnilsson · · Score: 1

    If you think this sounds interesting, but don't have any clue what it's about (is that possible? :-), CIELab describes a color using three decimal values (L, a & b).
    The difference between two CIELab values is called Delta E. You can find a formula here.

    --
    No sig to see here. Move along.
  31. Re:Land's Two Color visual perception work by SkywalkerOS8 · · Score: 2, Interesting

    I did work on this in college for a physics of light and color class. His experiment worked best when he used cyan and red filters for the projectors/cameras. Cyan is the light equivalent of combining blue and green. So in effect, you get RGB, with only taking two black and white samples of a scene.
    This is also how 2-chip DLP works. 1-chip DLP uses a color wheel containing RGB, and alterately projects an image of each color, the chip is, in essence, the black and white sample. 2-chip DLP uses a cyan filter on one of the projector's chips, and a red filter on the other, in effect, reproducing Land's experiment! 3-chip DLP uses a chip for each of RGB.

  32. One more usefull link by Anonymous Coward · · Score: 0

    http://www.compuphase.com/cmetric.htm

    An important quote from the page :

    "do not take my word for granted, nor that of anyone else. Experiment! Compare! Actions speak louder than words; and remember:

    knowledge through measurement"

  33. Delta E is the answer. by Anonymous Coward · · Score: 0

    http://www.popphoto.com/HowTo/ArticleDisplay.asp?A rticleID=103

  34. Re:This is relevant why? by Anonymous Coward · · Score: 3, Insightful

    This is an excellent question, as male engineers have the tendancy to be Red/Green colorblind.

    In order to help those of us who can't match our shirts with our pants, various "color models" have been developed over the past 340 years (although some pre-date plato), including RGB (cube), HSV (tetrahedron), CIE, YIQ, PANTONE (spherical/spiral), etc. Although this question is not exactly technical in nature, the underlying problem is about the mathmatics of converting the various geometries of the color spaces with an emphasis on web usability and accessibility... gdb with or without a serial cable is of little use here.

    Check out: http://www.adobe.com/support/techguides/color/colo rmodels/main.html

    And for the math:
    http://academic.mu.edu/phys/matthysd/web226/L022 1. htm

  35. Overthinking by NMerriam · · Score: 2

    You're trying to approach a simple task with far too complex an array of mathematics and programming skill.

    You want to select colors that contrast with each other, yes? Humans are more sensitive to value than anything else. Painters and photographers and designers (well, not so many designers :P) use this in work every day.

    Forget about saturation and hue -- if the value of the adjacent colors is 20-30% different, you can be pretty sure that most human beings will be able to see the contrast between them. Note that i'm talking about value in the sense of 0 being black and 100 being white. So you can easily make 3 or 4 colors simultaneously contrast with each other.

    Feel free to pick hue and saturation at random, you'll have a pair of colors that contrast and go together. Doing more than 2-3 colors is harder to make the colors work together without someone with design skill stepping in...

    --
    Recursive: Adj. See Recursive.
  36. Colour Separation... by Zero+Sum · · Score: 1
    You are, unfortunately, doomed to failure if you try and separate colours by their 'mathematical' colour.

    The human eye does not see 'true' colours, but only what the pigments in the cones can detect.

    This means that the numeric separation and the perceptible separation are not parallel if graphed.

    You will need to adjust your calculations for the nature of the pigments in the human eye. And these differ somewhat (accounting for the 40+ types of 'colour blindness').

    --

    Zero Sum (don't amount to much). [root@localhost]

  37. Why? by hacksoncode · · Score: 1
    I think a key question to ask yourself is what purpose are you truly attempting to accomplish.

    Theoretical models are an interesting thing, and if your goal is some kind of experiment into human perception, then I can't really help you.

    However, having been a software engineer a long time, I've learned the hard way that you have to ask the right question first.

    For example, if your goal is to produce only colors that have sufficient contrast to be readable (for example), that's a very different problem than if your goal is to exclude the fewest possible color combinations as unreadable.

    A trivial solution to the first problem is to allow only black on white (or some other suitable selection), but it's probably a very unsatisfactory solution. However, thinking of it in these terms, it would be possible, for example, to generate a hash table of a very large set of possible color combinations, or even of ranges of reasonable color combinations.

    This would be a very unsatisfactory solution to the latter problem though (BTW, I don't know of a really good solution to the latter problem in general... in fact I doubt there is one that would work at all unless you constrain the possible set of people that might try to view your images (due to various forms of color blindness up to and including total color blindness)).

    But perhaps that's a useful hint anyway...

  38. No clean solution... by chhamilton · · Score: 1

    As others have alredy pointed out, this is an intractable problem, and there has been lots of research into it.

    The creation of a perceptually uniform color space (ie: where some metric, typically the Euclidean norm, between two colors is directly proportional to the "visible" difference between them) has long been a holy grail, and the color space generally accepted to do the best job is CIELAB. However, CIELAB is known to suffer from non-linearities throughout its gamut. Also, the approach you are taking is a little simplistic, as to accurately determine perceptual color distance you need to incorporate the viewing conditions at the viewer's end, plus the properties of the display.

    If the purpose of this is simply to ensure that two colors are distinctive when placed together, the simplest approach is to use only the luminance information (there are many different ways of calculating 'luminance', but they all involve a weighted average of the color components); you can rest assured that if the luminance difference is large enough, the color's will be perceptually distinct.

    This problem comes up a lot in color reduction literature, and there are tons of resources out there on this stuff... be sure to check out citeseer (researchindex.com). Some of the quick and dirty metrics I've seen that do a fairly tolerable job is to convert to luminance-chrominance colorspace (ie: YUV, YCbCr, etc...), and then take a standard Euclidean norm, but weight the luminance contribution heavier than the chrominance contributions (something like 2:1 works well). Again, this is far from uniform, but it's tolerable, and when used in color reduction algorithms produces noticeably better results than simple RGB Euclidean.

    Tough problem with no clean answer. May I ask what exactly your not-for-profit organization wishes to do with such a metric?

  39. There is no "good" solution. by Wyzard · · Score: 1

    I wish I had the link... but I was doing some reading of my own about color spaces a few weeks ago, and one article I read said that the CIELAB color space was intended to make it possible to measure perceptual differences between colors, but was found to be inadequate for the purpose. But there's currently no other color space that's better for the purpose.

  40. Color Perception by SlowGenius · · Score: 1

    The human eye is most sensitive to light in the
    range of 500-550 nm or so, which is corresponds
    to green light. Human color perception is
    a result of three different types of light-absorbing pigments (opsins) in the cones of our
    eyes. One type absorbs best at about 425 nm
    (blue), another at about 530 nm (green) and the
    third at either 530 or 560 nm, (green or yellow,
    but nonetheless referred to as the 'red' cone
    opsin, for reasons which will hopefully be made
    clear.) The two different values for the
    maximum 'red' opsin absorbances are given because
    there is a very common genetic variant even in
    people with "normal" color vision that allows
    some people to be much better at distinguishing
    lower light frequencies (i.e. reds).

    Human color perception results from the RELATIVE
    amount of activation of the different types of
    cone cells; thus, even though 'red' cones are
    most adept at absorbing yellow light, green
    cones are very active in this range also; as the
    frequency decreases (wavelength increases),
    the red cones are activated in higher proportions
    relative to the green cones. An additional
    factor complicating all of this is that the
    numbers of different cone cell types in our
    eyes is not equal; I forget which is most
    prevalent, but they vary by a significant
    amount. Anyway, all this might not seem
    directly related to your question, but the
    take-home message is different "normal"
    people have different color sensitivities,
    but since our ability to distinguish different
    colors derives from being able to distinguish
    between different levels of activation of
    our various cone cells, our vision is most
    attuned to color differences in the regions
    where our cone cells have reasonably strong
    overlaps- i.e. specifically between about 470
    nm and 630 nm. (i.e. there are lots of colors
    on both edges of our perception--blues and reds--
    that we don't perceive differences between
    very well.)

    between very well.)

    --
    Listen to what I say, not what I mean...
  41. Many possibilities by vektor_sigma · · Score: 3, Interesting

    I would recommend making sure you are accounting for the gamma of your monitor in your matricies. That is, your transforms should be, R'G'B'->RGB->XYZ->L*a*b* and then compare. You can also try making comparitions in L*u'v' space, which is also supposed to be "perceptually uniform". You should also generate some gradients in L*a*b* space and see if they match some you might find on the web.

    That said, both of these colour spaces are really only approximations, and I think they'll be weighted towards uniformity in pure colours. Maybe a colour that pulls from a wider range of the spectrum like orange or gold might be smaller than the green or blue areas. I'm going to try and generate some test images to verify this either way.

  42. Why not ask the kids? by MarkusQ · · Score: 4, Interesting
    Why not ask the kids? Make it a game of some sort (details depending on age) where they have to find and click on some target word or image. Track how often (or how quickly) each combination is picked, and you'll have all the data you need to answer your question. To keep from wasting time in the parts of colour space where you know the answers (yes, navy blue text shows up well on a pale pink background) have the game advance through levels (each level having less distinction than the one before) until they have three wrong clicks/timeouts. Then start over with another base colour pair.

    -- MarkusQ

  43. Graphic Gems books by n1vux · · Score: 1

    The Graphics Gems series of books have multiple algorithms for color-space transformation and color-difference / closest color. HSV and HSL are both plausible candidates.

  44. Once had to same problem, by Tha_Zanthrax · · Score: 1

    I just did: Color1 := #ffffff - Color2 It actually only works on colors that closely ressembled a primairy (red, yellow, blue) or a secondary (orange, magenta, green) color. He, deal with it, I'm not the one who is letting the /.-crowd do his job. :)

    1. Re:Once had to same problem, by Mr+Z · · Score: 1

      Yeah, your "formula" doesn't work too well for colors around #808080, does it?

      --Joe
  45. Re:This is relevant why? by ElDuque · · Score: 1


    Man, if you don't care about it, don't read or comment on it!

    Are you suggesting that the 15 seconds it takes you to read the front page story and decide if it interests you is too much of a waste of your time, nevermind the people who are interested by it? That is really what the editors do...every story has a group who will be interested and a group that won't be. They decide if enough people will be interested in the story to justify sacrificing the 15 seconds of time uninterested people like you will spend looking at it.

    If you don't think something is worthy of slashdot, just relax and move on.

  46. Re:This is relevant why? by selan · · Score: 2
    So basically you just don't like the whole "Ask Slashdot" topic. It's never news and no one can guarantee that the question will always matter to you. Why not filter out the whole topic and forget about it?

    PS. Yes, you are trolling and I fell for it. Well I was bored :).

  47. The problem. by Mister+Transistor · · Score: 2, Informative

    I co-wrote one of the most popular Ray-Tracing programs out there, and learned this from my travels.

    Your problem is coming from an effect called Metamerism. This is a phenomenon that causes us to perceive 2 colors as the same when they are not.

    The whole problem is caused by our moronic RGB model of light. It's not that simple, in reality. It's like thinking of the audio spectrum as being divided into Treble, Midrange and Bass, and all tones (frequencies) expressed as a "quantity" of bass, treble, and midrange. Stupid, hmm? Well, our RGB model has caused the same stupidity in the optical spectrum.

    The visual spectrum is continuous, just like the audio and RF spectrums. A given light source (color) is almost never a single line color on a spectral scale, unless it's a monochromatic laser.

    The different spectral peaks for a given light or color sample will be assimilated by your eyes and brain as a given color. There are MANY combinations of spectral peaks that can APPEAR to be the exact same color, yet a measurement system such as HSV or CIE or even RGB will see them as very different. This is called Metamerism.

    Even worse, the effect is also compounded by a given color sample looking different under various spectral distributions of illumination (i.e. different colors of light)

    For more research on this effect, consult the people that devised the CIELAB scale, Hunter Labs. I learned about this effect in a book written by them! Unfortunately, this book was lent to me by an old associate years ago, and I don't remember the details, like the exact name.

    --
    -- You are in a maze of little, twisty passages, all different... --
  48. CIE-L*a*b* & Munsell by michaeldouma · · Score: 3, Insightful
    For measuring color differences, your are on the right track. CIE-L*a*b* was designed to be fairly perceptually even, but it is still quite nonlinear and delta-E values mean different perceptual steps for different hues, as seen in the shapes of acceptability ellipses. Here's some samples.

    An older approach is the Munsell system. His system, which he began in 1898 with the creation of his color sphere, or tree, saw its full expression with his publication, A Color Notation, in 1905. It is not mathematically based, but rather each step corresponds to an actual equal perception step.

    Even though there are surprisingly large discrepancies between CIE L*a*b* and isotropic observation-based color spaces, such as Munsell, a good bet is to convert your LAB into Munsell and go from there.

  49. I have source code for this. by Naysayer · · Score: 2, Informative

    You have to make sure your RGB values are in light-linear space (gamma = 1). The default, when you read them from a bitmap or a screen or something, is that they are not (gamma = 2.4 or thereabouts). So if you read colors out of a bitmap and put them through your 3x3 matrix, you won't actually get the right CIEXYZ colors. So then the final step (XYZ to LAB) is pretty meaningless.

    So before you convert a pixel to XYZ, do this:

    [1] Make sure each component is in the range from 0 to 1 (so if it's from an 8-bit-per-channel image source, divide each channel by 255).

    [2] Raise each channel to the power GAMMA, where you define GAMMA to be something like 2.4.

    [3] Now push the colors through the 3x3 matrix you came up with (which of course requires you to know what your illuminant and RGB phosphors are like... I use illuminant D65 and the standard phosphor responses and get good results).

    I have source code I can send you. jon@bolt-action.com. Also, search on the web for Poynton's "FAQ about Color and Gamma".

    -N.

  50. Some things to check out by cosyne · · Score: 3, Informative

    First off, if you just want to make sure the colors are visible on top of each other, you could calculate the luminance of each color using .30*R + .59*G + .11*B and make sure that those numbers differ signifigantly. Some other rules of thumb are here, under color rules.

    As far as color discrimability, you might want to look for info on MacAdam's ellipses of just noticeable color differences. There's a picutre on this page which shows the main idea: how different a color has to be in order to notice the difference depends on what color it is. Humans can discern more shades of green than red or blue.

  51. Vischeck by meryl · · Score: 1

    Another excellent color blindness resource: http://www.vischeck.com/.

    --
    The geekygirl from Texas
  52. Try looking for the OSA-UCS by GrimJim · · Score: 2, Informative

    That's the Optical Society of America Uniform Color Space. You can find out more here. Cartesian distance in this space corresponds to perceptual difference, more or less.
    http://www.colorsystem.com/projekte/engl/49osae. ht m
    Although the space presented is a bunch of discrete points, there exists formulae to relate the three coordinates (L,j,g) to CIE x,y,z. The corrected formulae are tucked away in this paper on page 18.
    http://color.psych.upenn.edu/brainard/papers/spe ci fication.pdf
    The space has the property that perceptual difference roughly corresponds to Cartesian distance between points for differences more than 20x just-noticable.

  53. Human tetrachromats (possibly) found by Goonie · · Score: 1

    Read the scoop here.

    --

    Any sufficiently advanced technology is indistinguishable from a rigged demo
    --Andy Finkel (J. Klass?)
  54. Also.. by thecarson · · Score: 2, Interesting

    As a sidenote, I'd like to point out that the color yellow can cause sick people to become more ill. Just as red/orange makes someone hungry, bright yellows make someone sick. it can even induce epileptic shock. True! That's why hospitals are always lavender and purple.

    1. Re:Also.. by Peyna · · Score: 1

      Then how come my whole room is a nice neutral color, including all the furniture, and I'm still hungry all the time? Unless you count my mouse pads, they're the only red thing around.

      --
      What?
  55. Subdividing color space by TuVox · · Score: 1

    If you're trying to subdivide color space into n colors, where n colors are as "psychophysically" as separate as possible: Save most of the channel for brightness - our eyes can distinguish brightness/greyscale much better than hue or saturation. The psychophysical conversion for RGB to grayscale is .55*G + .33*R +.12* B - this means that green is twice as bright as red which is three times as bright as blue. It also means you should carve up your color sampling space similarly. Best psychophysical color space division I've ever seen is Apple's 256 color picker palette.

  56. R, G, B... S? by jaavaaguru · · Score: 2

    Ok, you mentioned R, G and B, but what about the other one ?

  57. "Retinal Envelope" by bigattichouse · · Score: 1

    The pigments of the eye give you an envelope of useful distances.. anything that falls in the envelope will give you a good match, anything outside the envelope will appear "non-sensical" .. assuming you were terachromat, then the difference woould be obvious... imagine a cube.. now imagine your visual ability fell within an oddly shaped balloon inside the cube... this would also give you a working algorythm to judge whether R-G colorblind and others would be able to view a combination. You, an "average" person could create the envelope by judging randomly selected pairs, and drawing the appropriate shape in 3d from there.

    --
    meh
  58. Try Tektronix HVC color space by keithp · · Score: 2
    Tektronix developed a CIE-traceable colorspace called 'TekHVC' which is designed to be perceptually linear along the three dimensions of hue, value and chroma (saturation).

    XFree86 includes support for this colorspace in Xlib.

    1. Re:Try Tektronix HVC color space by Anonymous Coward · · Score: 0

      dunno about their color space, but it's fucking hard to get their printers to output anything remotely resembling the correct colors. these things have some serious problems in some characteristic areas of common spaces...

      ie, they suck at color.

  59. blue vs not blue by andy_fish · · Score: 1

    One thing to keep in mind is that the eye is fairly bad at recognizing an edge where one side has blue and the other side doesn't have blue. (i.e. it's hard to read blue text on black background, or yellow text on white background). This has to do with the difference between the scotopic & photopic systems. Basically, our blue color-sensors are from an "older" system.

    --
    & I wish I knew the password to your heart . . . &
  60. Use HLS by Rui+del-Negro · · Score: 1

    Human perception is closer to HLS (Hue, Luminance, Saturation). Personally, I would use this model to determine how "similar" two colours are.

    Note: some programs use HSB (Hue, Saturation, Brightness) instead of HLS, but it's basically the same thing (just a different order).

    RMN
    ~~~

  61. Use LUV by Anonymous Coward · · Score: 0

    CIE XYZ is not a perceptually-uniform space. Use CIE LUV instead.

    Color comparison (even on a monitor) is a hairy topic, and depends a lot on your monitor, how far you are from it, gamma correction, and so on --- these wacky subtleties can influence the perceived accuracy of your comparison.

    Here is what you should have read instead of posting this question:
    Color FAQ (see Question 34, "What is perceptual uniformity").

    1. Re:Use LUV by alexmeaden · · Score: 1

      All you need is LUV!

  62. Colour Differences. by Anonymous Coward · · Score: 4, Informative

    There are several things that you need to know:

    1) People are generally MUCH less sensitive
    to differences in BLUE than in RED and
    somewhat less sensitive to RED than to GREEN.

    2) Gamma correction is poorly implemented across
    the web - that results in great differences
    in the percieved colours for the brightest
    and dimmest R, G or B values. This is hard
    to cope with.

    3) Don't forget colourblind people! This can
    result in people finding it hard to distinguish
    various colour values depending on the nature
    of their disability.

    4) Women see subtle differences between greenish
    blues MUCH better than men.

    5) The CIE cromaticity diagram includes a bunch
    of colours that a CRT cannot reproduce.

    6) How distinguishable two colours are depends
    critically on the backgrounds against which
    they are presented and how close they are to
    each other in space and time.

    7) In the real world, colours can be pure,
    single frequences of light - or complex
    chords with many, many frequencies. A CRT
    can only display light of three frequencies,
    so most pure colours and even most mixtures
    of colours can't possibly be accurately
    depicted. Fortunately, human eyes can
    only *measure* the light intensity at
    three basic frequencies - so CRT's appear
    to work acceptably. However, the frequencies
    of light generated by the phosphors in a CRT
    or the LCD's in a flatpanel are not the
    same exact frequencies that the human eye
    detects. That results in a lot of strange
    non-linearities.

    8) The colours produced by a particular RGB
    triplet will be different on CRT, LCD,
    printer ink, etc. That can make a huge
    difference in readability.

    CONCLUSION:
    ~~~~~~~~~~~

    You have a LOT of research to do!

  63. Damn the monitor, shift to R Theta color wheel. by Erris · · Score: 3, Interesting
    I'm not sure about all the technical limitions of various monitors, but the color wheel sitting on my desk looks like the answer. It has complementary colors 180 degrees apart. So Red is opposite of green, blue from orange, purple from gold etc. These are all optimal contrasts, except for people who are red green color blind. Combinations that are close with respect to angle, like red and red-violet do not contrast much.

    Try using the color sum, R+B+G for radius and the ratio of colors for angle. The outside would be white, the center black and a mean radius would have R+B+G = 256 and so contain the pure colors. Limits of acceptable difference could be set to accomodate for any crappy old monitor.

    If no one else has come up with this rather obvious aproach to digital color, I hearby delcare first art and grant anyone and everyone the right to use this basic IDEA without further consultation. You'll have to do some work to make that idea practical, but the basic idea seems to have been working for designers, graphic artists, archetects and plain old painters for a long time.

    --
    DMCA, Hollings, Palladium. What might have sounded like paranoia is now common sense.
    1. Re:Damn the monitor, shift to R Theta color wheel. by benjymous · · Score: 2, Insightful

      Red and green may be opposite each other on the colour wheel, but have you ever tried reading red text on a green background (or vice versa?)

      --
      Help me! I'm turning into a grapefruit!
    2. Re:Damn the monitor, shift to R Theta color wheel. by Anonymous Coward · · Score: 0

      then perhaps try a different angle... there's no requirement that optimum (or minimum) difference needs 180 degree separation... right? :-)

  64. Not just distance, but spectrum by mughi · · Score: 2

    ...since Psych 101 covered that blue and red make the most psychologically disturbing color combination, despite their difference in colorspace. I think it could have something with them being on completely different ends of the visible spectrum.

    This does remind me of the info on mutant tetrachromat females. And also for the different types of normal color blindness. A color-blind friend from work pointed out this page on the types to point out the different effects. And a different co-worker happens to be an extremely rare type, perhaps 'monochromat?'

    Anyway, what you use should consider distance in colorspace, and also position in the spectrum, with the effects of the different types of colorblindness taken into consideration also.

  65. Spatial CIELAB by smgxarw · · Score: 3, Informative

    One problem might be that color perception depends on the spatial structure of the scene as well as the pure CIELAB coordinates. At least one research group has taken a stab at including spatial information into a model of image quality. Take a look at
    http://white.stanford.edu/~brian/scielab/scielab .h tml

    vischeck.com also have an interesting take on simulating color deficiencies (although not the perceptual differences between 'regular' colors). 'Color blind' might be interested in this.

  66. it uses polar coordinates? by karm13 · · Score: 1
    i don't think it does.
    if i remember correctly, L is basically the brightness, while a and b go from green to red and yellow to blue (i'm not sure about the directions, though).

    oh, and such a tool would be useful. not only fr designers, i imagine it could be used for compression as well. maybe he should ask the codec guys, they should know a way to determine if two colors are distinguishable from another.

    --

    --
    making up good sigs is a hard thing to do.
  67. Or a sigmoid space / logistic f(x) by Anonymous Coward · · Score: 0

    if related to the perception of intensity. On maps, people tend to overestimate small positive values when contrasted to white, and once the ink gets up to around 85% of the maximum, they squash it all together as 100%. There are plenty of color models: RGB and HSV are popular, but they are not the only ones. Try reading the German philosopher/poet Goethe; he came up with another color system.

  68. just to make sure... by karm13 · · Score: 1

    you test two rgb values being distinguishable, don't you?
    because if you just pick two colors in CIELab and test them, then convert to RGB you would be outside of its gamut most of the time.
    i thought i'd ask, just to make sure.

    --

    --
    making up good sigs is a hard thing to do.
  69. The CIELAB colourspace is not uniform by Anonymous Coward · · Score: 0

    The CIELAB colourspace is not symmetrical. Some colour comparisons may have a large colour difference yet may appear very similar to the human eye, whereas others will appear very different. The eye is very sensitive to shades of grey for example, yet there are many shades of yellow over a wide area of the CIELAB colourspace which the human eye has difficulty distinguishing.

    1. Re:The CIELAB colourspace is not uniform by cullenfluffyjennings · · Score: 1


      This is complete bogus - the CIELAB space was one of the few spaces that was designed to be as close to perceptually uniform as possible. It may not be perfece but is is quite good - I think you are confusing IED Lab* space with something else.

  70. MacAdam Color Discrimination Ellipses by kris_lang · · Score: 2, Informative
    While most of the posts here have talked about color management and about the difficulty of creating perceptually equal color difference metrics, and while I do agree that this is a difficult topic with no definitive answer at present, no one has mentioned actual work on this topic. MacAdam explored this topic by having targets change "color" in different directions in CIE-1931-xyz coordinates and measuring the standard deviation when subjects were able to make a match in color appearance to the surround / background color. He measured this at 15-25 points in CIE-1931-xyz colorspace over a few papers that he published in the 1940's. The targets were 2 to 10 degrees in size and measured at a luminance of 48 lux. These color tolerances for color matching were called the MacAdam Ellipses and can be found at www-cvrl.ucsd.edu, a web site which is migrating to England soon. Newer studies work on the JND, the Just Noticeable Difference. Please note that if you look at a MacAdam ellipse diagram that the ellipses are drawn at approximately 10 (ten) times the size of the actual discrimination ellipses in CIE-1931-XYZ color space.


    You can try to work these ellipses into your formulae, and people like Parra in France and Parry Moon in Camridge (MA) had tried to distort these color ellipses back into circles in trying to find a
    transform of these color spaces into a perceptually uniform color space. But the key thing is that the monitors will differ, the monitors' settings will differ, (the phosphors don't really differ that much between CRTs, but the primaries for CRTs are very different from that of LCDs and that of projectors using LCDs or DLP/DMDs), and most importantly the viewers' photopigments will also differ. Along with the well known ~10% of males that are dichromats, a large number of the population are anomalous trichromats. The actual numbers are still being tallied, and it is still in a very conjectural stage whether most people have multiple copies of the L-opsin gene or multiple copies of the M-opsin gene. The Nathans are on one side of this and the Neitzes are on the other side of this. Which is which, I keep forgetting.


    But a quick summary is:


    the majority of human subjects are most sensitive to changes in the red (+L-M) or green direction (-L+M), with changes of 0.3% being perceptible for targets of 2-10 degrees in size, mediumly sensitive to changes in intensity (+L+M[+ maybe S]) {there are HUGE arguments and PhD theses brewing over this} for brighter and -L-M[ - maybe S] for darker), and least sensitive to changes that affect the S-cones (+S, kind of a violet change, -S, kind of a greeny-chartreuse change). This, along with the MacAdam Discrimination Ellipse, are for a target color being compared to the immediately adjacent surround color. This does not hold true for nonadjacent and distant targets being compared or for targets subtending visual angles much larger than 5 degrees or much less than 1-2 degrees. There are some funky changes that occur when you get to targets of less than 1/2 degrees in size and when you start to talk about colors that you don't look at foveally or centrally.


    That may answer your question. And it may even lead you towards a workable plan on equi-perceptual space. (work with CIE xyz and integrate MacAdams' discrimination data). But realize that MacAdams' work, like much of visual psychophysics is based on less than 5 (count 'em five) subjects. Most visual psychophysics papers today usually have the authors and their post-doc slaves as the only subjects. But actually coming up with that will take data collection on the scale of a PhD thesis, and working within the CIE color space, even from 1931, is probably close enough for most work, even if some of your side-by-side colors are twice as far in color space than they need to be at minimum.

  71. Shouldn't be too hard, with basic color theory by jcsehak · · Score: 3, Informative

    Arrange the primary and secondary colors in a circle. Since you're in the digital realm they would be Red, Green, Blue; and Cyan, Magenta, Yellow. Put Red at the top, then every 60 degrees mark off another color. It should read like this from the top going aroumd clockwise: R, Y, G, C, B, M. These are the hues. Now if you measure the degrees between 2 different hues (the shortest distance), you should have a good indication of their contrast. That is, Red on Cyan is a lot higher contrast than Red on Red-with-a-little-yellow-in-it.
    Of course, there're two more variables: Saturation and Value. Imagine in the center of the circle there's a dot of neutral grey, and a gradient from that grey out to the colors. That is, a dot on the edge at 120 deg. would measure as Green at it's highest saturation point, and as you move to the center of the circle, it would get duller and duller until it reached grey. The same for all the other colors. This way you can measure a color's saturation.
    Now for the most important aspect: Value. Value is a measure of how light or dark a color is of you took away all the color information (ie, converted it to greyscale). One of the first things you learn in art school is that a difference of Value is higher contrast than a difference of Hue or Saturation. Black on White is the highest contrast you can get, and Red-on-Green and Red-on-Grey fall somewhere in the middle. So you now have to extrude to color model in 3d space so it looks like a cylinder. The top disc should be all white and the bottom disc should be all black. Now you can find out the difference in contrast of two different colors by locating them on the model and measuring their relative distances in 3d space. The tricky part: how tall do you make the model? I'd recommend about twice as high as it is wide. This would mean that White on Black is twice as contrasty as Green on Magenta.
    Now here's the really tricky part: the original color wheel you made in the beginning isn't just a flat disc in the center of the cylinder- it's all floppy. The Cyan and Yellow edges should be close to the top, since they're very bright (close to white), and the Red and Blue ends should be nearer to the bottom, since they're darker.

    Photoshop does a pretty good job of representing everything except the last paragraph. If you go to the color picker and click on the H toggle button (HSB), you'll see that the rainbow strip represents the circumfrence of the original circle, and the x-axis in the grid represents Saturation while the y-axis represents Value (Brightness). Where it falls short is it says that Cyan at it's highest Saturation is no brighter than Blue (fully saturated)! Of course, it's obvious that Cyan (with a perceptual brightness of (I'd say) around 95, is much brighter than Blue (which I'd guess had a perceptual brightness of 30 or so). But there are good reasons why Adobe chose to do the HSB color measurements this way.

    Hope this helps. I don't know how you would program it, but it's good for picturing it in your head.

    Josh

    --

    c-hack.com |
  72. Why? by Jobe_br · · Score: 2

    OK, I have read and reread the original post a few times now and have read most of the highest moderated comments and I still have a question: why? Why are you trying to determine this? Are you designing a website? If so, why do you need a mathematical model? I work closely with a designer with many interactive (read: web) site designs under her belt and I can assure you, she uses no mathematics in making very amazing designs.

    So, pray tell - what do you need this for? Especially considering that if you are working on a website, you should really consider limiting your colorspace to the 216 (or so) web-safe colors. It's not so much to support people with 8-bit color (though many such machines still exist) but more to provide a more uniform experience across multiple platforms (read: video cards, monitors, gamma corrections, etc.)

    Also, don't forget that a not-for-profit must conform to S.508 accessibility guidelines (you're familiar with that as a not-for-profit web developer, right?).

  73. Different perceptions of different colors by Lord+Bitman · · Score: 1

    Our eyes dont use flat colors, we sense different wavelengths differently, and RGB is just seperate wavelengths running together from being so close. In short, changing the Red value may be easier to see than changing the blue value, etc

    --
    -- 'The' Lord and Master Bitman On High, Master Of All
  74. Delta E baby! by Anonymous Coward · · Score: 0

    You'll find that a Delta E value on a grey/green/blue is _much_ more visible than the equivalent on a yellow/red, e.g. the tolerance where I work for calling a colour a 'match' on most colours is a Delta E of ~0.1, whereas on a yellow even 1.0 is hard to see.

  75. Watch out for your CRT by AtomicBomb · · Score: 1

    There is two more thing you got to watch out when playing around with different colour spaces.

    First of all, your CRT (LCD, printer or whatever) has a pretty limited colour gamut . In the other words, the colour in the real world and math eqn are richer than the display. When the colour that you want is not present, the display device will map it to something else. So watch out, esp for the the very "rich" colours.

    The other thing is, if you are programming using C/C++, please double check your castings. Quite likely, your RGB is in uchar, your CIELAB needs floating point calculation somewhere through the calculations. Ample room for careless mistakes.

  76. Optical Illusions by Iaob · · Score: 1

    A bit of a side note, but when two colors are put next two each other, often times a third color appears near where the two colors meet. The most extreme example is the old black and white grid; near the intersections of the white lines, black spots will appear; putting a purple square on a larger yellow square will make the yellow turn color. A whole art movement is based on adjacent colors and the resultant perceptions: pointillism.

  77. MOD UP by Anonymous Coward · · Score: 0

    MOD UP!!

  78. strange coincidence by medina · · Score: 1

    Hm... by a coincidence, the site in the next posting on Slashdot, on a timeline of the future, also contains a white paper "Designing for colour blind users". Might be worth a read for understanding some of this and solving some of the problems.

    http://www.btexact.com/white_papers/downloads/WP 10 4.pdf

  79. Or try the L in LAB by Panoramix · · Score: 3, Informative

    If you are already converting to CIELAB, try using the L component alone, not the full Delta E. That yields very good results. Probably color-blind people will have less problems with the generated colors, too, since this is about perceived brightness, not hue (but I'm not too sure about this).

    I just made a quick Perl hack to test this. It generates 500 pairs of random colors, and outputs them sorted by "distance". It does so converting to LAB and then computing "distance" as abs(L1-L2). Check the output here, mail me if you want the script.

  80. Try this metric by DotComVictim · · Score: 1

    sqrt((r2-r1)*(r2-r1)*a+(g2-g1)*(g2-g1)*b+(b2-b1)*( b2-b1)*c)

    Try a = 1, b = .9025, c = .0081

    This is based on the tri-stimulus cone model, I used a,b,c (a normalized) based on the fraction on light received by the human eye.

  81. Designing for colour blind users by Anonymous Coward · · Score: 0
    I discovered this while scanning around the BT Exact site listed in the next article on Technology Futures. Being that I am in the 7% of the world population that is partially colour blind myself, I found it of interest: The eye of the beholder - Designing for colour blind users

    "Colour-blind computer users see things differently from most people, but this is seldom considered in the design of software or web pages. This article offers a simple technique for simulating the differences, to help designers and developers avoid disadvantaging their users."

    Enjoy!

  82. Forget the math. by Anonymous Coward · · Score: 0

    Simple method: Take a screengrab of your proposed color scheme and convert it to greyscale (or just turn the saturation all the way down on your monitor!). If you can't read it there, it is not a good scheme at all. Value contrast is far more important than color contrast.

    Simpler method: Hire (or otherwise coerce) somebody with training in color choice - an artist.

  83. Intensity by a3d0a3m · · Score: 1
    Here's something from a little project I have worked on myself recently. My project was to create images that seem to be made from random colors but in fact make an image because the value (I) is the same.

    It is done by converting the pixels, with a simple RGB->Greyscale formula I found on the net. I do this by converting the pixels from 3 bytes R,G,B to one byte using a simple proportion of the three bytes, yielding I. The formula is
    i=floor(.3*r+.59*g+.11*b)
    Then I pick random R,G,B values until those values, when converted have the same I of the source pixels. This makes for some interesting looking images.

    What you could do to see if two colors are going to be very visible ontop of eachother is convert those two colors to the I value and see how far apart they are. This should work, just play around with how far apart they should be and you'll be fine.

    Good luck,

    Adam
  84. Not been reading slashdot very long by autopr0n · · Score: 2
    --
    autopr0n is like, down and stuff.
    1. Re:Not been reading slashdot very long by BWJones · · Score: 2

      Not been reading slashdot very long have you?

      Actually yes, if you would have taken the time to see my user # 18351, it indicates that I have been here for a while. However, I do step away from my screens for short periods of time, so perhaps I missed that one.

      Thanks

      --
      Visit Jonesblog and say hello.
  85. For those who don't know the basics: by lkeagle · · Score: 3, Informative

    This is probably exactly your problem, but even so, I feel your research is far to subjective without adding quite a bit of statistical research (which has already been done, so don't completely reinvent the wheel). The biggest problem is that any mathematical computations about modelling light are done in radiometric space, where light is considered pure energy of varying frequency (Joules, Watts, and other simple(?) units). In reality, we see on a different, completely NONLINEAR scale, known as the photometric scale (Talbots, lumens, etc. (very complex)). Converting between the two involves the use of what are called Spectral Luminous Efficiency Curves. These are the conversion factors that take into account that the eye has widely varying response to different frequencies of light. Not only are they highly non-linear, the only reason they appear to be smooth is that they are a statistical average of many, many different individuals' efficiency curves.

    In other words, if your data isn't lining up, the fundamental problem is that the response of individuals' eyes are rarely comparable. Then again, there's all kinds of psycho-visual effects that can screw up this kind of research without even taking this into account.

    Sorry you chose to pick such an incredibly complex subject to research, but good luck in your results!

    ~Loren

  86. Math problem in conversions? by Laurion · · Score: 1

    The reason you might be getting quite similar as well as quite dissimilar pairs might just be one of algebra. For instance, in the quadratic equation, you get two roots. I know that in some cases taking the wrong root can give you an exact wrong answer when doing further parts of an equation. Might something similar be accounting for your bad combinations?

    --
    "Is this not a rare fellow, my lord? He's as good at any thing, and yet a fool." -from "As You Like It", Act 5,
  87. Re:Perceptually equal color spaces (addition) by lkeagle · · Score: 1

    FYI, the highest contrasting color scheme for text has been found to be yellow text on a black background... Yuck...

    ~Loren

  88. Color by smithcd · · Score: 1

    Yes, Land's original theory of color perception, and his remarkable demonstrations (in complete contradistinction to existing theory) that were published in Scientific American in the 50s (I think, or possibly the 60s)

  89. Empircal lookup tables by doom · · Score: 2
    Have you thought about just using empirically determined lookup tables? I was messing around with some things like this and I found it was just a total pain to try and programmatically determine even very simple things concerning perception of color (just as an example: I figured I would be able to write a simple function that would determine whether a color would look "blueish". You just see if the B term looks large compared to the R and G terms, given the appropriate weighting factors, right? But this just doesn't work).

    Anyway, my solution was to resort to empirical testing, and stash the result in lookup tables. Since I was only interested in the "web safe" color pallette, the number of colors I had to deal with was easily manageable. I wouldn't be suprised if this is the right way of doing it even with a larger color space (you could record data for a coarse mesh and then try and interpolate the results for the colors inbetween your test cases...)

  90. Hire a good artist.. by Axe · · Score: 3, Insightful
    ..stop wasting your time and your company money - hire a good artist/consultant to disign and review colors. There is no magical formulas that can substitute expert human opinion, on what is nice to see.

    Color spaces are great for development of the displays and printers - there you have to get down to as few basic parameters as possible. They are useless for designing output of printers and displays..

    --
    <^>_<(ô ô)>_<^>
  91. Sounds like you haven't taken gamma into account by raph · · Score: 3, Informative

    From your description, it sounds like you are converting RGB colors into XYZ using only a linear matrix multiplication. This isn't correct - you also need to take gamma into account. If you want to follow a standard, try the sRGB colorspace. Otherwise, it might be good enough to simply raise the raw RGB values to the power of 2.4 or so before the matrix multiplication.

    CIELAB is reasonably accurate for evaluating color differences, but research in color spaces that more accurately reflect perception is ongoing - a good recent paper is this one. Also, the Argyll color management system implements most of the color goodies you might want, including CIECAM97 (which is widely considered to be an improvement over CIELab).

    It's amazing to me how little (and poorly) color theory is taught, in spite of color being one of the more universal human experiences. My guess is that this is largely to do with the cross-disciplinary nature of color. It's not merely a branch of physics, psychophysiology, pigment chemistry, math, or art, but overlaps all of them.

    Try the gamut changes and see if that helps.

    --

    LILO boot: linux init=/usr/bin/emacs

  92. Simple answer by wackybrit · · Score: 1

    All you folks have taken the bait and gone into the nerdy ways of solving this problem.. I have another solution.

    Get a Web designer who's not color blind and can see whether a color is visible or not just by looking at it.

  93. Re:It depends on the difference and how it's appro by Anonymous Coward · · Score: 0

    Based merely on experience, I'd say that it's a good idea to look away for a moment before looking at any pair of colors for difference.

    I'm sure everybody knows that if you look at a weakly visible outline you can see clearly initially (such as a shadow in weak light), it disappears altogether in 10 seconds or so if you stare at it.

  94. Redefine your question by dybdahl · · Score: 1

    You are developing a website. You don't need a generic method that determines if two colors differ enough - you need methods to find suitable colors that differ enough.

    Several posts have good explanations on how to pick colors so that they differ a lot, including taking care of colorblind kids. That will make you finish the website much faster than doing cutting edge color research!

  95. Close, but you probably need HSV space... by dfung · · Score: 1

    Characterizing perceptual color differences is pretty hard - as some of the earlier posts mention, this is the focus of a lot of research.

    RGB space won't help you out. It was a good try to go to Lab space, but this actually will make the simple solution harder. Lab is great for retouching as it separates the monochrome information into the L (lightness) channel and the color information to the a&b channels. Practically speaking, that means you could scan an image in RGB or CMYK, convert to Lab space, then very easily apply a sharpening convolution to the image. This sharpens the detail in your image while minimizing or eliminating color shifts. If you tried to do this in RGB, you would need a ridiculously complex kernel to sharpen without color distortion. Try this in Photoshop and amaze your friends.

    But if you do this in your case, you can't use the L channel as you've removed all the color info. And you need a weird vectorizing brain to understand what a value difference in a&b mean.

    You actually want to go the other way, to HSV space. This is a polar space, where the the H channel represents the hue, S channel is saturation, and V is the brightness component. Once you do this matrix conversion from RGB, you'll probably want to establish a threshold value for differences in the H channel. That forces the colors to be a minimum "space" apart. You probably will also want to set a threshold on V as well so "light red" and "dark red" can be distinguished. As you describe the problem, you might want to look at whether S differences are meaningful, but I doubt that will be the case.

    Because of the way your eyes work, a simple threshold won't provide perceptually proportional differences throughout the spectrum, but for a simple test as you describe, a basic threshold should be fine.

    Good luck!

  96. Pipelining by trumpetplayer · · Score: 1

    "It takes 9 months to bear a child, no matter how many women you assign to the job."

    Dividing the whole 9 months in time slices and assigning a woman to each is what we call pipelining..

    1. Re:Pipelining by Hal-9001 · · Score: 1

      That works if you want to beget nine children as quickly as possible, but if you just want one child as quickly as possible, it's going to take about 9 months.

      --
      "It take 9 months to bear a child, no matter how many women you assign to the job."
  97. You need "Color Physics for Industry" by Asmodeus · · Score: 1

    ISBN: 0901956708
    This book specifically addresses the problem you describe, complete with equations. Once you correct the maths in it, the results are very good. Metacol use similar maths in their die/paint colour quality control programs, I used these equations to produce a similar product until the company folded...

  98. tv forumlar by Anonymous Coward · · Score: 0


    try to calculate brightness of the two colors by

    y=0.299*r+0.587*g+0.114*b

    r,g,b .. are the color values 0-255 if your using the web colors
    y .. will give u the brightness of the color 255 white, 0 black

    we use this formular in our chat software to allow/disallow certain colors in correlation with the background color (keep it readable)

    greetings
    cyn

  99. photomosaics by rjforster · · Score: 1

    Juggle is a photomosaic program a friend wrote (in Java, GPL'd, used in LIMP, check it out)

    He has a doc on his website which explains some of the problems and gives the algorithms (with refs) which he used to work out which colours were closest for the purposes of matching sub-tiles to parts of the target image. You want the algorithms.pdf link.

    (Sorry about the tagging, I couldn't work out how to lose the hannover bit in the comment)

  100. so many mistakes ... by nurbz · · Score: 1

    I read part of the previous replies, and as a colour specialist, I decteted many mistakes. I dont intend to correct all of them, or to know everything about the subject, but I hope my relative knowledge of this field might help the author of the question.
    Lets analyze again your problem. You want to define if 2 colours are sufficiently different to be distinguished. And for that you want to use a colour difference metric. I assume that when you say "on top of each other", you dont mean transparency. And so far, I agree with you. So you are trying to transfer your RGB values into a perceptual colour space, in order to use a colour difference metric. First step: RGB to CIEXYZ First, you can directly apply a 3x3 matrix to compute this transform only if you have CIERGB values. CIERGB values are obtained if the spectrum of your apparatus is similar as the human visual system cones, i.e. if the spectral sensitivity of your red emittor or receptor is equivalent to the human cone sensitive in the red part of the spectrum. And that is unfortunately possible. To go to XYZ, you need to build a more complex transform based on a model derived from the characteristics of your apparatus, i.e. the monitor. GOG models are usually the best for monitors. But you would need to do it for your monitor, and all others where your soft will be ran. Indeed, each monitor have got different characteristics, as someone already mentionned. And I dont even mentionned that you should calibrate your device. So you cannot build a transform which will be accurate enough for every cases. Fortunately, the sRGB transform was defined. If you dont know anything about an image (which device was used to create it), it allows you to transfer its colours to CIEXYZ in a way which is, if not accurate, is as close as possible, given that you dont know anything about it. With sRGB, you can define a roughly correct transform to CIEXYZ. Then to CIELAB: the transform is straight forward, providing that you choose the right std illuminant. I am sure you read the CIELAB colour space is a uniform one, but thet truth is that it was the most uniform one when it was created(1976). Which means that the same colour difference in different regions of the colour space may have a (very) different perceptual difference. Several more complicated colour difference formulaes were thus designed to improve things, all based on the CIELAB, but I dont remember their name. Ask me if you really want to know. Furthermore, a better solution to compute a colour difference would be to use the state-of-the-art perceptual colour space, CIECAM97s, which is MUCH more uniform, and the corresponding difference formula. But the transform is VERY complex, and I am not sure whether you can afford to implement it. Especially since the RGB->XYZ transform is already an approximation.

    Although vision is an easy task - we dont even think about it, the associated process is very complicated. Think: 40% of the human brain is dedicated to vision and related tasks. If one considers the processing power of the brain, you can understand the innerant difficulties.
    Some tips to help you: calibration is an important step, which has to be done for every monitor you target. And you have to build a transform for each of them. But that is not possible. You have to take this into account. sRGB is the best choice for you. And a simple euclidian distance in the CIELAB space is definitely not accurate enough. Consider more complex formulaes. No easy solution sorry. As I said, vision, and especially colour vision, is a paradoxal field. It seems almost easy, but is yet so very much complex! Good luck. DO not hesitate to mail me for questions. nurbz2 at ematic dot com.

    1. Re:so many mistakes ... by Anonymous Coward · · Score: 0

      Other colour difference formulae that use the CIELAB colour space include CMC, MS89 etc. There are quite a few of them.

      I used to use several different colour measurement packages in my work. One in particular called ImageMaster by DataColor International was the best attempt at representing true colour differences on a computer screen. Which is great if you have £20,000 to spend on software.

  101. You need the Color FAQ... by igomaniac · · Score: 1

    Charles Poynton maintains an excellent FAQ for color and gamma related questions, that is infrequenctly posted to comp.graphics.algorithms. You can get it online here: http://www.inforamp.net/~poynton/ColorFAQ.html

    --

    The interactive way to Go -- http://www.playgo.to/iwtg/en/
  102. Yah, amber monitors :-) by Anonymous Coward · · Score: 0

    But I thought glowing green screen has more retro appeal... you can still read the screen 10 seconds after you've turned off the monitor...

  103. Try this code... by BeenaBerry · · Score: 1
    I wrote some Java code to deal with colourspace stuff.. it converts in the way you describe, returns the "difference" between two colours, and can also tell you if two colours are "different" for dichromatic colour deficient users. It's on Freshmeat here, LGPL license, and the project homepage (at my previous employers' site) is here.

    If anyone wishes to add to or improve this code, I'm sure the changes would be welcomed.. I'm no longer maintaining the code but there is a mailing list at the project site which can be posted to.

  104. KISS by Anonymous Coward · · Score: 0

    The proposed problem has a finite domain. The fastest, and most reliable method would simply be to create a table (matrix) that holds the answer to each combination. Then your program can look up the answer in one step.

    Set up a second table for color blind folks.

  105. Re:Sounds like you haven't taken gamma into accoun by jcupitt65 · · Score: 1

    Hey, that's the post I was going to write! :)

    CIECAM97 is probably much more complicated than you can use. It lets you take into account crazy stuff like the colour of the wall behind the screen that the person is using to view your web page.

    What people call CIELAB is actually CIELAB76. There is an updated version of the standard called CIELAB94 which is quite a bit better, and also CIELAB2000 (which I've not used yet).

    John

  106. MacAdam Discrimination Ellipses by kris_lang · · Score: 3, Informative
    While most of the posts here have talked about color management and about the difficulty of creating perceptually equal color difference metrics, and while I do agree that this is a difficult topic with no definitive answer at present, no one has mentioned actual work on this topic. MacAdam explored this topic by having targets change "color" in different directions in CIE-1931-xyz coordinates and measuring the standard deviation when subjects were able to make a match in color appearance to the surround / background color. He measured this at 15-25 points in CIE-1931-xyz colorspace over a few papers that he published in the 1940's. The targets were 2 to 10 degrees in size and measured at a luminance of 48 lux. These color tolerances for color matching were called the MacAdam Ellipses and can be found at www-cvrl.ucsd.edu, a web site which is migrating to England soon. Newer studies work on the JND, the Just Noticeable Difference. Please note that if you look at a MacAdam ellipse diagram that the ellipses are drawn at approximately 10 (ten) times the size of the actual discrimination ellipses in CIE-1931-XYZ color space.

    You can try to work these ellipses into your formulae, and people like Parra in France and Parry Moon in Camridge (MA) had tried to distort these color ellipses back into circles in trying to find a transform of these color spaces into a perceptually uniform color space. But the key thing is that the monitors will differ, the monitors' settings will differ, (the phosphors don't really differ that much between CRTs, but the primaries for CRTs are very different from that of LCDs and that of projectors using LCDs or DLP/DMDs), and most importantly the viewers' photopigments will also differ. Along with the well known ~10% of males that are dichromats, a large number of the population are anomalous trichromats. The actual numbers are still being tallied, and it is still in a very conjectural stage whether most people have multiple copies of the L-opsin gene or multiple copies of the M-opsin gene. The Nathans are on one side of this and the Neitzes are on the other side of this. Which is which, I keep forgetting.


    But a quick summary is:


    the majority of human subjects are most sensitive to changes in the red (+L-M) or green direction (-L+M), with changes of 0.3% being perceptible for targets of 2-10 degrees in size, mediumly sensitive to changes in intensity (+L+M[+ maybe S]) {there are HUGE arguments and PhD theses brewing over this} for brighter and -L-M[ - maybe S] for darker), and least sensitive to changes that affect the S-cones (+S, kind of a violet change, -S, kind of a greeny-chartreuse change). This, along with the MacAdam Discrimination Ellipse, are for a target color being compared to the immediately adjacent surround color. This does not hold true for nonadjacent and distant targets being compared or for targets subtending visual angles much larger than 5 degrees or much less than 1-2 degrees. There are some funky changes that occur when you get to targets of less than 1/2 degrees in size and when you start to talk about colors that you don't look at foveally or centrally.


    That may answer your question. And it may even lead you towards a workable plan on equi-perceptual space. (work with CIE xyz and integrate MacAdams' discrimination data). But realize that MacAdams' work, like much of visual psychophysics is based on less than 5 (count 'em five) subjects. Most visual psychophysics papers today usually have the authors and their post-doc slaves as the only subjects. But actually coming up with that will take data collection on the scale of a PhD thesis, and working within the CIE color space, even from 1931, is probably close enough for most work, even if some of your side-by-side colors are twice as far in color space than they need to be at minimum.

  107. colorblind vision simulator by wickline · · Score: 1

    warning: not directly related, but likely of interest to folks interested in this thread

    I've got a colorblind vision simulator in development which aims to help web developers select background/foreground colors that work for color blind users.

    It simulates three different types of colorblindness and also simulates different gamma correction (to emulate other platforms' renderings) as well as black and white monitors.

    The source is available, which may (or may not) help in the application which initiated this thread (I *hate* javascript, but that's what this uses, so the source is javascript).

    http://wickline.org/ref/colorlab/
    requires javascript and frames and normal color vision and a color monitor

    feedback requested to
    aware-colorlab@hwg.org

  108. Re:Perceptually equal color spaces (addition) by balachandran_c · · Score: 1

    I believe that it is not just the luminosity that makes it tough to read red text on a blue/green background. The focal length of any lens depends on the wavelength of the light passing through it. which means while red light will be focused on the retina the blue region (higher wavelength) is out of focus. This puts strain on the eye and it becomes tough to maintain focus. (This effect is more pronounced when viewing red over blue / blue over red since they differ in wavelength). You might have observed that viewing red text over blue give some sort of funny feeling and your eyes get tired pretty quickly.

    More on Chromatic Aberrations here

  109. Still not good by Anonymous Coward · · Score: 0

    For example: the pair [{ 47, 59, 31}, { 10, 66, 25}] separated by 1.64 are completely indistinguishable, while [{206, 94, 144}, {58, 151, 70}] (distance 0.43) generates pretty readable text. On my monitor, in a well lighted room on a monday morning.

  110. Re:Perceptually equal color spaces (addition) by GTRacer · · Score: 2
    It's funny you mention that, because back in my C64 days that was how I programmed...

    Even in 1990 when I got my first PC clone, it was yellow text time!

    GTRacer
    - I need an Apple ][ video cable...

    --
    Defending IP by destroying access to it? That makes sense, RIAA/MPAA. Go to the corner until you can play nice!
  111. No by chfleming · · Score: 1

    "Even specifying colors by the wavelength of the light emitted or reflected covers only a small subset of colors--in fact an even smaller subset than any of the primary color representations."

    If I were to construct a discrete function N(lambda), where N is the number or photons, and lambda is the wavelength. Then I would be done.

    You see. This is true because it is completely independent of any subjective judgements made by human or animal.

    (assuming of course that the different receptors in the eye are independent of each other in space and in time, which they might very well not be, but all of the other models assume this too)

  112. Chromaticity Differences by biggaijin · · Score: 1

    The CIE color map was developed as an industrial tool to identify the colors used in paints, etc quantitatively. It was calculated based on psychophysical measurements of color appearance, but it is an engineering approximation. For example, the calculated CIE color space has three dimensions, and the paper representation that is commonly used is a two-dimensional projection of the calculated space. The CIE representation of color space is robustly nonlinear; it was intended only as a way to identify a color, not as a way to document the differences among colors.

    As other posters have already pointed out, the differences between colors are quite complex and have not been studied and documented enough to provide a measure you can use to predict objectively the differences between colors you are using. As a former vision and color scientist, my advice is to eyeball the differences in the work you are doing now.

  113. 1st step by Anonymous Coward · · Score: 0

    Your colors aren't in linear RGB, they are in non-linear R'G'B' so you have to convert from non-linear R'G'B' to linear RGB first. Then convert to CIEXYZ...

    This conversion is easy to do and you can find out how to do it from the Charles Poynton Color FAQ.

  114. Did this a couple of years ago by UnknownSoldier · · Score: 3, Interesting

    I wrote an image recognition system for the lumber industry a few years back.

    People (graders) using neon chalk would write on boards (The marks would designate the board quality, and where to cut the bad pieces off.) The boards and chalk would go under a housing with UV light, which had a photosensitive trigger. The trigger would signal the computer, to capture the image. The computer would analyze the image, and send out appropiate bits to a PLC which controlled the saws and sorting.

    As you have found out, RGB does *not* uniquely identify colors. We worked around that problem in 2 ways:

    1) carefully choosing our chalk color.
    2) I then converted the colors over to HSB and used a relative error of Hue to determine if 2 colors were "close enough."

    It wasn't perfect, but it was close enough and extremely fast.

    I doubt HSB will be sufficient for your domain, but see if you can "change the problem" to make it more computer friendly :-)

  115. stg not in this CIELAB page by Anonymous Coward · · Score: 0

    is the fact that the phospors that you use for rendering an RGB value are not pure, so that the R* G* B* point that represent the phosphors of a CRT in a R,G twodimensional plot will look like this:

    G 1|
    | G*
    |
    |
    | B*
    | R*
    0+-----------
    1
    R

    Now, simply, you cannot render with the CRT a color that falls outside this R*,G*,B*. There are many shades of blue-green that you wont be able to get on your monitor: You can express them mathematically as a linear combination of R*,G*,B*, but one factor is negative, and no CRT can do that yet !-)

  116. Just a little correction... by locoluis · · Score: 1

    ... the EGA (at least mode 640x350x16c) indexes 16 colors to use from a palette of just 64 colors, 4red*4blue*4green.

    Or at least that's what I knew back in the time when I learned to program in *cough*Qbasic*cough* in 1994.

    1. Re:Just a little correction... by lkeagle · · Score: 1

      oops, that's exactly correct... Thank you.

      ~Loren

  117. Short anwer -- You missed a step. by CompaniaHill · · Score: 1

    Sorry I'm late joining this conversation! I've worked on color-science software at three firms now, and I think I can cut through the murk here and give you a short and practical answer.

    In general, to do any kind of color science, you'll need to do three things:

    1. Convert the "pixel" RGB values into "linear luminance" RGB values in your favorite luminance units. These are your transfer functions.

    2. Convert the linear RGB values into CIE XYZ values using your monitor's chromaticities.

    3. Convert the CIE XYZ values into your favorite perceptual space using an appropriate white point. CIE L*a*b* is popular, and good enough for most uses.

    (Step 4 would involve deciding how to handle out-of-gamut colors -- a topic in itself! -- but you won't need to worry about this.)

    Clearly, you've missed step 1. A few of the previous responders have already pointed this out. Most CRTs are sufficiently well-behaved that their transfer functions can be adequately described with a simple power function described by a single gamma value. (1.7, 2.2 and 2.7 are popular values. 1.7 is "lighter" and 2.7 is "darker".) But don't assume that LCD monitors can be described this way! My experience has shown that some models come close, while others can only be adequately modeled by interpolating tables of gray values laboriously measured with a photometer.

    One additional piece of advice. If your final goal is to determine the legibility of one color of text over a different-colored background, you may want to ignore the 3-D color difference formulas entirely, and simply compute the contrast from the L* values alone.

    Whatever you decide, let us know how it turns out!

  118. Regarding tetrachromacy by zoon0 · · Score: 1
    Regarding tetrachromacy, it is difficult to say definitively whether any human tetrachromats have or have not been found.

    For example, while Hemos of Slashdot may say Mutant Tetrachromat Females Found redherring.com has an article Looking for Madam Tetrachromat which puts forward a more complex view:
    For years now, scientists have known that some fraction of women have four different cone photopigments in their retinas. The question still remains, however, whether any of these females have the neural circuitry that enables them to enjoy a different -- surely richer -- visual experience than the common run of humanity sees. "If we could identify these tetrachromats, it would speak directly to the ability of the brain to organize itself to take advantage of novel stimuli," says Dr. Neitz. "It would make us a lot more optimistic about doing a gene therapy for color blindness."

    . . .

    Dr. Nathans also believes, however, that for full-blown tetrachromacy, the fourth photopigment must not have a peak in sensitivity that is too close to the peaks of either the red or the green photopigments. That's the rub, as far as he's concerned -- he suspects that most female tetrachromats would have only mildly superior color vision, because the genetics indicates that the fourth photopigment would almost always be very close to either the red or the green. Every now and then, however, an oddball photopigment might appear, well separated from both red and green. "The genetics do not rule it out," Dr. Nathans explains. "It would be a rare event. But who's to say it hasn't happened? There are a lot of people out there."
    A view which a story in The Guardian echos.

    As for the "hyperdimensional" nature of true tetrachromatic vision, it seems unlikely the perception would be truly four dimensional in these cases; far more likely that the extra receptors will help improve hue resolution in their sensitive areas, making "hyperdimensional" a misnomer.

    In any event, the executive summary is some humans have more and some have less hue resolution than you, so it is best to ignore hue for color discrimination considerations.
    1. Re:Regarding tetrachromacy by BWJones · · Score: 2

      It's valid that the issue of true tetrachromacy is in question. Genetically one could be demonstrated to have more than three photopigments, if one could examine the pigments (there are ways to do this noninvasively) they could determine whether or not one had more than three photopigments, but the ultimate proof would lie in both behavioral studies and the examination of the retinal circuitry. (I do the latter for a living).

      I used hyperdimensional in the mathematical sense for a reason. In that typically we regard any thing higher than three space as hyperdimensional. For instance, there are organisms that see in five to seven space and one could appreciate that it would be possible to deconvolve their respective individual perception spaces into readily separable and quantifiable dimensions of analysis.

      --
      Visit Jonesblog and say hello.
  119. I'd use HSV by Wesley+Everest · · Score: 2
    Other people have mentioned color-blindness, and that should probably be done as a final check if everything else says it is visible. Since you are looking at whether things are visible on top of one another, then here are some rules off the top of my head that might do the trick:
    1. If Value of both is close to 0, then No - because they are both dark
    2. If Saturation of both is close to 0, and the difference of both colors' Value is close to 0, then No - because they are both similar shades of grey
    3. If the 3D distance between the colors is close to 0, then No - they are the same color
    Then you just need to tweak the 4 thresholds to get it right. And you might need 3 tweakable weights for computing the 3D distance.