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?"

28 of 199 comments (clear)

  1. Read this relevant document by saforrest · · Score: 5, Informative

    A friend of mine wrote a paper on this topic:

    Limitations of Colour Management.

  2. 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.

  3. 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!
  4. 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 :)

  5. 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.

  6. 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

  7. 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.
  8. 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."
  9. 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.
  10. 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

  11. 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.

  12. 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

  13. 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.
  14. 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.

  15. 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.

  16. 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!

  17. 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.
  18. 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.

  19. 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)
  20. 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 |
  21. 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.

  22. 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

  23. 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..

    --
    <^>_<(ô ô)>_<^>
  24. 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

  25. 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.

  26. 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 :-)