On Thursday 21 February 2002 5:55 pm, Mike Ressler wrote:
> On Thu, 21 Feb 2002, Asger K. Alstrup Nielsen wrote:
> > On Thu, 21 Feb 2002, Angus Leeming wrote:
> > > and the problem is now defining an appropriate mapping from the colour
> > > colourmap to a grayscale or monochrome one.
> >
> > I'm not sure what the problem is, but if you want to convert from
> > color to grayscale, just do this:
> >
> >   int gray = (red + blue + green) / 3;
> 
> Actually, the better way to do this is (xv Postscript code)
> 
>       gray = 0.32 * red + 0.5 * green + 0.18 * blue
> 
> or perhaps (NTSC)
> 
>       gray = 0.30 * red + 0.59 * green + 0.11 * blue
> 
> Either gives a better match to a human's RGB to luminance conversion.
> Definitely not (R+G+B)/3!
> 
> Mike

Thanks, Mike. I'll take the xv code.
A

Reply via email to