Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!falstaff.mae.cwru.edu!jb From: jb@falstaff.mae.cwru.edu (Jim Berilla) Newsgroups: comp.graphics Subject: Re: RGB to gray Message-ID: <1990Nov23.033335.16411@usenet.ins.cwru.edu> Date: 23 Nov 90 03:33:35 GMT References: <1990Nov19.050822.12771@metro.ucc.su.OZ.AU> <1990Nov20.105041.19140@galadriel.bt.co.uk> <1375@radius.com> Sender: news@usenet.ins.cwru.edu Organization: Case Western Reserve University Lines: 55 Nntp-Posting-Host: falstaff.mae.cwru.edu In article <1375@radius.com> pierce@radius.com (Pierce T. Wetter III) writes: >>Use: Y = .299 R + .587 G + .114 B > > That will work for the NTSC phosphor set. If you want to be completely >anal about it you need to recalculate the formula for each phosphor set. > > Or at least use the formulas for the SMPTE phosphor set. > >Pierce Something's not quite right here. I have no doubt that the above famous formula is correct, but aren't the scale factors built into the monitor? I mean, if you apply zero volts to all three inputs of an RGB monitor, then you get black. (Hopefully no disagreement about that.) But if you put in 1 volt (or .707 or whatever) on each of the three inputs, then you get white, not a sick cyan-ish white that the above formula would imply. Or am I missing something? When doing greyscale work on a PC with a VGA card (no flames please, the sparc's on order) I use the following algorithm to set the pallet: (Note that the VGA has 256 colors, but only 6 bits per dac) 0 <= icolor <= 252 red(icolor) = icolor/4 green(icolor) = icolor/4 + iand(icolor,2)/2 blue(icolor) = icolor/4 + iand(icolor,1) red(253) = green(253) = blue(253) = 63 ! the neat formula red(254) = green(254) = blue(254) = 63 ! screws up for red(255) = green(255) = blue(255) = 63 ! these values. This gives a pallet table that looks like this: color r g b color r g b color r g b color r g b 0 0 0 0 8 2 2 2 16 4 4 4 248 62 62 62 1 0 0 1 9 2 2 3 17 4 4 5 249 62 62 63 2 0 1 0 10 2 3 2 18 4 5 4 250 62 63 62 3 0 1 1 11 2 3 3 19 4 5 5 ... 251 62 63 63 4 1 1 1 12 3 3 3 20 5 5 5 252 63 63 63 5 1 1 2 13 3 3 4 21 5 5 6 253 63 63 63 6 1 2 1 14 3 4 3 22 5 6 5 254 63 63 63 7 1 2 2 15 3 4 4 23 5 6 6 255 63 63 63 Adding in a bit of blue and/or green smooths out the steps that would occur in a 6-bit (64 level) greyscale. It seems to work well for me, with no strange color tinges in the picture. -- Jim Berilla / jb@falstaff.cwru.edu / 216-368-6776 "My opinions are my own, except on Wednesday mornings at 9 AM, when my opinions are those of my boss."