nanogui@linuxhacker.org

nanogui@linuxhacker.org


Subject: Re: GdFindNearestColor
From: Greg Haerr
Date: Sun, 23 Jan 2000 12:55:00 -0700

: ¿Why the different weights to the three color components in the cuadratic
: mean error calculation? Has it something to do with the hardware? Have I
: missed that school day?
:

Manuel,
    Those are included in attempt to convert based on luminescence, rather
than just color space.  The formula to convert RGB to grayscale uses
those constants to convert to b/w luminescence, as they correspond
to the relative brightness of each of the colors.

Actually, I have seen other algorithms that are quite a bit faster; I've been
considering changing the line in GdFindColor() from

    sq = (long)R*R*30*30 + (long)G*G*59*59 + (long)B*B*11*11;

to
    sq = abs(R) + abs(G) + abs(B);

Perhaps you should try that and see how the color match algorithm
works with the std gray palette...  Let me know.

Regards,

Greg



nanogui@linuxhacker.org