Color Remapping - Matching target palette using a 3D grid?
Let's say I have color 'FOO', and it is stored in RGB format. I need to recolor 'FOO' so it matches the closest color in a list of colors. Doing this on the fly, couldn't I view the RGB values from each color as points on a开发者_如何学C 3D grid (r=x, g=y, b=z) and compute the distance between point 'FOO' vs the points from each color in the list?
The closest point to 'FOO' would be the replacement color?
In theory, yes. In reality, computing the closest color is non-trivial if you want to do it well. Just for example, people's eyes are much more sensitive to changes in brightness than color shifts, especially toward the ends of the color range (i.e., toward extreme reds or blues).
At least if you don't mind some extra work in the computation, you'll want to use one of the standard "delta E" computations (in your case, you'll want to minimize delta E). Note that these all (all I've worked with anyway) work in the CIE Lab* color space. In a typical case, you'll start with RGB, which you'll need to convert to Lab* first.
精彩评论