*** Welcome to piglix ***

Color difference


The difference or distance between two colors is a metric of interest in color science. It allows quantified examination of a notion that formerly could only be described with adjectives. Quantification of these properties is of great importance to those whose work is color critical. Common definitions make use of the Euclidean distance in a device independent color space.

As most definitions of color distance are distances within a color space, the standard means of determining distances is the Euclidean distance. If one presently has an RGB (Red, Green, Blue) tuple and wishes to find the color difference, computationally one of the easiest is to call R, G, B linear dimensions defining the color space.

When the result should be both computationally simple as well, it is often acceptable to remove the square root and simply use:

This will work in cases when a single color is to be compared to a single color and the need is to simply know whether a distance is further. If these squared color distances are summed, such a metric effectively becomes the variance of the color distances.

There have been many attempts to weight RGB values to better fit human perception, where the components are commonly weighted (red 30%, green 59%, and blue 11%), however these are demonstratively worse at color determinations and are properly the contributions to the brightness of these colors, rather than to the degree to which human vision has less tolerance for these colors. The closer approximations would be more properly coefficients of 2, 4, and 3: , one of the better low-cost approximations,


...
Wikipedia

...