in reply to the difference between two colors, and how to describe a color

Then I started to think whether RGB is indeed the right way to describe color for what I am doing, so the next thing I tried is to use
my $ll = 0.212671 * $r + 0.715160 * $g + 0.072169 * $b;
as the "color", and calculate the difference.
That seems like a way to calculate the graylevel of a color, as being used in color TV transmission (at least for PAL), and which is responsible for the fact that a B&W TV can show a color TV signal rather well (that as an aside, for the curious). I'm not exactly sure on the weights, I thought the value for blue was closer to 0.11. And indeed, looking at 3.3.3. Color Models in Video - YUV Color Model, I see:
Y = 0.299R + 0.587G + 0.114B

But why are you throwing away the other 2 values? You could use the whole of YUV, where Y is your above gray value, and U and V are the two other color components. Surely, a change in color tint is as important as a change in brightness.

And then there is HSV, another somewhat similar color value triplet.

Replies are listed 'Best First'.
Re^2: the difference between two colors, and how to describe a color
by pg (Canon) on Oct 28, 2004 at 16:22 UTC
    "the value for blue was closer to 0.11"

    The weight you gave here is very close to what tachyon had, and I will try this. Thanks for that link, I think you are right, I will look into it, and find a way to use YUV.

    The diffculty for me was not really the calculation of the difference, as that part seems to work okay. The problem is really that, for certain color combinations (background and foreground), the result is poor, that's why I am getting into the big question "what is color?". Your post and links are very useful and helpful. Thanks.

Re: the difference between two colors, and how to describe a color
by jonadab (Parson) on Oct 28, 2004 at 17:41 UTC
    Surely, a change in color tint is as important as a change in brightness.

    Both matter, but all else being equal a change in brightness is often more important. Of course, a small or gradual change in brightness is much less important than a sudden marked change in hue. It's a complicated issue. I tend to agree with the poster who said delegate it to a module that has an edge detection routine or filter.


    "In adjectives, with the addition of inflectional endings, a changeable long vowel (Qamets or Tsere) in an open, propretonic syllable will reduce to Vocal Shewa. This type of change occurs when the open, pretonic syllable of the masculine singular adjective becomes propretonic with the addition of inflectional endings."  — Pratico & Van Pelt, BBHG, p68