Path: utzoo!utgpu!radio!ziebmef!becker
From: becker@ziebmef.uucp (Bruce Becker)
Newsgroups: comp.graphics
Subject: Re: References sought on finding "closest match" to a color
Message-ID: <1988May31.223428.9410@ziebmef.uucp>
Date: 1 Jun 88 02:34:26 GMT
References: <11076@jade.BBN.COM>
Reply-To: becker@ziebmef.UUCP (Bruce Becker)
Organization: Ziebmef Public Access BBS/Unix
Lines: 34

In article <11076@jade.BBN.COM> mlandau@bbn.com (Matt Landau) writes:
>I'm looking for references to techniques that do a resonable at finding
>the "closest" match to a desired color, given a pool of candidate colors
>from which to select.  
>
>More specifically, given a target RGB value and an arbitrary sized colormap 
>consisting of RGB triplets over which you have no control, how do you go
>about choosing the nearest available color?
>
> Matt Landau		    	mlandau@bbn.com

The usual problem involves some form of quantization of the output color map,
so that the target color gamut is effectively partitioned by an octree.
Unfortunately the term "nearest" in RGB space is not closely approximated
by perceptual color space. A crude approximation would be to transform
to HSV coordinates and weight the search distance 2*H,1*S,4*V, where V has
been computed to be about 0.3Red+0.6Grn+0.1Blue.

Partitioning the color space into an octree is best referenced by the work
of Hanan Samet - ACM siggraph has Tutorials on some general methods...

Please note that it is entirely possible to define colors which are outside
the gamut of the target display media - it is not a simple task to decide
in the general case how to pick the nearest possible color, but a rule of
thumb is get the brightness right first, and try to get a color that
intersects the gamut on a line perpendicular to the V axis. This is not
always attractive when accurate color rendition is at stake...

There's lots more, but this should start you off OK..

Cheers, B. Becker

UUCP:   ...!ncrcan!ziebmef!becker!bdb
BitNet: BECKER@HUMBER