From jonathan@jvc.UUCP Mon Mar 6 23:18:53 1989 Path: leah!bingvaxu!sunybcs!rutgers!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!jvc!jonathan From: jonathan@jvc.UUCP (Jonathan Hue) Newsgroups: comp.graphics Subject: Re: RGB color maps Summary: CIELUV color difference Message-ID: <323@jvc.UUCP> Date: 7 Mar 89 04:18:53 GMT References: <45570@linus.UUCP> Organization: JVC Laboratory of America Lines: 29 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