MadSci Network: Computer Science Query:

### Re: How do RGB values relate to luminance?

Date: Tue Nov 16 04:48:54 1999
Posted By: Troy Wu, Staff, Electrical Engineering, Stanford University
Area of science: Computer Science
ID: 936563948.Cs
Message:

Color is a physiophysical phenomenon; i.e., light emitted by a source of a certain wavelength will be interpreted as a color when viewed by a human. Therefore, many concepts of color are based on what we believe a human is perceiving, rather than solely on the distribution of wavelengths in a given emission of light. Therefore, for your conversion program, it's not just a simple relation between your color spaces (24-bit color and 8-bit grayscale). To begin, the grayscale value of a pixel in an image is a measure of the pixel's luminosity in its original color. I hope the following helps....

I quote from Image Processing for Computer Graphics by Jonas Gomes and Luiz Velho:

The process of color perception is believed to take place in two steps. In a first step, the signals R, G, and B are generated by cells containing the corresponding types of photosensitive molecules.... In a second step, these signals are combined, and what is sent to the brain are the combined signals R + G, R - G, and B - (R + G). It is an empirical fact that the B component has very little influence on whether a color is perceived as light or dark, so it can be said that the composite signal R + G corresponds roughly to the luminance.

The other two, R - G and B - (R + G), encode the remainder of the color information, technically known as chrominance.

Try using just R + G (of course normalized around the depth; e.g., for a 24-bit color image (8,8,8) to 8-bit grayscale, use ((R + G) / 2). This is, as the quotation indicates, empirical data, so you may have to do some tweaking. You might try using different weights for R and G, or you might try adding some blue. Again, remember to normalize around the depth so that you get a number between 0 and 2^gbd, where gdb is the Grayscale Bit-Depth.

Let me know how it goes; you can email me directly:
troy@cinema35.dhis.org

Current Queue | Current Queue for Computer Science | Computer Science archives