# Maximal color difference

I have a picture consisting of a two-dimensional array of ordered triples (red, green, blue) of real numbers from 0 to 1. I'm looking for something like a norm on pictures which expresses the range of colors used.

The idea is that a grayscale image should have norm 0 and an image with pure red, green, and blue should have norm 1. Here's the key part: A colorized image (black and red, for example, instead of black and white) should have norm 0 just like a grayscale image. So if all colors are linear combinations of two colors the norm is 0, and the extent to which a third basis is needed to represent the colors used (even if only for one pixel) is the norm.

Any ideas on how to formalize this?

My first instinct is to change bases to (hue, saturation, lightness) and look at the maximum difference of hues (mod 1). But then two points with colors $(\varepsilon, 0, 0)$ and $(0, \varepsilon/2, \varepsilon/2)$ would seem very distant where they actually represent colors which are very close (near-black).

It seems natural at this point to transform the problem into one of geometry and look at the color bicone, but what is the most natural metric to use here? Euclidean? L1? Something else?

Of course other approaches would be welcome.

-
I do not think that there is a good answer to this question. As fas as I know the question of an "appropriate metric on the space of colors" is open. You formulated many problems yourself: hue is measured mod 1, but brightness makes a difference for equal "hue-distance". Moreover, other things affect the "distance of two colors" such as textures, ambient colors, contrast,... – Dirk Jul 10 '12 at 20:12
@Dirk: Probably so. But I'd still like to see some decent solution, even if there may not be a single perfect solution. (I might even hold out hope for that...!) – Charles Jul 10 '12 at 20:20
Measuring distances between colours is best done in the Lab colour space, which is designed so that Euclidean distances approximate perceptual differences between colours. – Rahul Jul 11 '12 at 5:08
@RahulNarain: But regardless of whether I look in the HSL bicone, the HSV cone, the RGB cube, or in Lab space I still don't know how to solve the problem at hand, even if I assume the L2 metic. – Charles Jul 11 '12 at 7:23
@Rahul: What was wrong with your deleted answer? – joriki Jul 31 '12 at 1:08

In a grayscale image, all the colours lie on the line segment $(t,t,t)$ for $t \in [0,1]$. On a black-and-red image, they lie on $(t,0,0)$, and on a red-and-white image, on $(1,t,t)$. A sepia-toned image contains colours on a curve that passes through black, brown, cream, and white; whether you consider this one-dimensional depends on whether you're only looking for "flat" affine subspaces or general curved submanifolds of the RGB cube.