Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!datapg!com50!midgard!dal From: dal@midgard.Midgard.MN.ORG (Dale Schumacher) Newsgroups: comp.graphics Subject: Re: Color quantization: flesh tones (really RGB->YIQ) Summary: RGB -> YIQ conversion matrix Keywords: color rgb yiq quantization Message-ID: <1212@midgard.Midgard.MN.ORG> Date: 18 Sep 89 22:52:18 GMT References: <6087@pt.cs.cmu.edu> <124742@sun.Eng.Sun.COM> Reply-To: dal@midgard.Midgard.MN.ORG (Dale Schumacher) Organization: The Midgard Realm, St Paul MN Lines: 27 In article <124742@sun.Eng.Sun.COM> falk@sun.Eng.Sun.COM (Ed Falk) writes: | |Here's a thought; try converting RGB to the NTSC IYQ coordinates |and quantize in IYQ space. I suggest this because NTSC chose |the Y axis to be biased towards flesh tones and TV pictures transmit |more power along that axis than along the Q axis (I is intensity). | |I'm sorry, but I don't have the transformation matrix from RGB to IYQ handy. | I thought Y was the intensity (luminance) component... and the most bandwidth is used for the luminance, with less for the color components. Here are the integer [0..255] pixel value formulae that I use: Y = (((77 * R) + (150 * G) + (29 * B)) / 256); I = (((153 * R) + (-70 * G) + (-82 * B)) / 256); Q = (((54 * R) + (-134 * G) + (80 * B)) / 256); R = (((256 * Y) + (245 * I) + (159 * Q)) / 256); G = (((256 * Y) + (-70 * I) + (-167 * Q)) / 256); B = (((256 * Y) + (-283 * I) + (436 * Q)) / 256); The above forms the heart of a utility I wrote to set the luminance (Y) of a color image from a monochrome image. I use this in convolutions, particularly for edge sharpening, such that I do the convolution only on the luminance component, then recombine the output with the original color image.