[comp.graphics] RGB color maps

jfjr@mbunix.mitre.org (Jerome Freedman) (03/03/89)

  I am writing this for a  co-worker who does not have access to
usenet please attribute mistakes and dumbnesses to my mis transcription:


  I am new to the world of color graphics and I am writing (or
trying to write) a program to display a color image. I am working on
a Sun 3/160, Sun Os 3.2 - 4.2 BSD, using smalltalk-80, 8-bit RGB.

  I have two requests

1) Does anyone have adescription of a good "basic" RGB color table.
My color table can have a maximum of 256 colors in it and I want to
select that group of RGB values which gives a "good" cross section of
colors.

2) I also need an alogorithm that takes a given RGB value and chooses
which entry in the basic color table described above that best approximates
a given color.

 Also any suggestions, references, pointers will be appreciated
 
                                                Jerry Freedman, Jr
                                                jfjr@mbunix.mitre.org

Jerry Freedman, Jr       "Why did 
jfjr@mbunix.mitre.org      Unix come from the east?"
(617)271-8398   

mac@trantor.harris-atd.com (Mike McDonald) (03/05/89)

>1) Does anyone have adescription of a good "basic" RGB color table.
>My color table can have a maximum of 256 colors in it and I want to
>select that group of RGB values which gives a "good" cross section of
>colors.
>

  There was a decent article in the Sept. 88 issue of IEEE Computer Graphics
and Applications on how to pick good color map.


  Mike McDonald

  mac@trantor.harris-atd.com
  postmaster@trantor.harris-atd.com
  (407) 727-5060

  Advanced Technology Dept.
  Harris Corp.
  M.S. 3A-1912
  P.O. Box 37
  Melbourne, Florida
             32902

jonathan@jvc.UUCP (Jonathan Hue) (03/07/89)

In article <45570@linus.UUCP>, jfjr@mbunix.mitre.org (Jerome Freedman) writes:
> 2) I also need an alogorithm that takes a given RGB value and chooses
> which entry in the basic color table described above that best approximates
> a given color.

The best method I know of (which means it isn't the best method, with 99%
certainty) is to minimize the CIELUV color difference.  This is defined
as:

delta E*uv = sqrt((delta L*)^2 + (delta u*)^2 + (delta v*)^2)

where L* = 116(Y/Yn)^(1/3) - 16 for Y > 0.008856, and
      L* = 903.3 * (Y/Yn) if not

and u* = (u' - un')13L*
and v* = (v' - vn')13L*

un' is the u' for your reference white and vn' is the v' for your reference
white, and Yn is the Y for your reference white.  Y, u', and v' can be
derived from RGB and your monitors chromaticity coordinates and reference
white by the equations I posted here recently.

I used this method to convert 24-bit color images to Amiga HAM format.
However, I found that combining this with error diffusion (F-S) dithering
was tricky, and am still working on a good solution.  It does work well
for just straight mapping.


-Jonathan	uunet!jvc!jonathan