Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I don't understand your question. Do you mean that you want to match the colour in a given location to the "closest" colour in a fixed set. If so you need to decide which colour space to use and calculate the distance. For RGB you will get good results if you assume the "distance" between two colours is the geometric distance, to compare $c1 and $c2:
(of course there is no point in taking the square root if you are comparing distances). If you want to be overly clever you can first convert to another colourspace (HSV would probably be good). Or you could be wanting to classify the whole picture (i.e. take the average colour work out the closest node and the direction of the difference to call it say "a pinkish green" colour? Or maybe I have misunderstood you completely? Update: Or are you thinking about dithering the image (replacing the full set of colours with some picked from a restricted set) in which case you need to look at a good text on "error diffusion" and Floyd-Steinberg. In reply to Re: Convert RGB to an actual color
by hawtin
|
|