# Measuring Color Part 2: The Visible Spectrum vs 3-Channel RGB Color

In my previous post, I laid out our overall goal: use a UV/Vis spectrophotometer to judge the color of fuel specimens. This post will introduce the two different kinds of information we will need to understand in order to solve the problem: the continuous spectrum measured by the UV/Vis spectrophotometer and the 3-channel RGB color value we want to use to identify the color.

## The Visible Light Spectrum

We will gloss over the less interesting challenges of repairing the UV/Vis and getting it to talk to a computer. In short, the device just needed some adjustments to its light sources, and it had an RS-232 serial port which I could use to transmit data through an adapter to a listening computer.

The most important piece of the puzzle is the kind of data our instrument produces. To use the spectrophotometer, we place a 1 cm wide cuvette containing our specimen into the sample holder. Then the instrument measures how much light at different wavelengths is transmitted through the cuvette and specimen.

So suppose we take a sample of fuel, pipette it into a cuvette, and take a quick spectrum measurement. This is what the resulting data looks like.

What we get is a spectrum. The vertical axis shows the transmittance, which ranges from 0.0 to 1.0. A value of 1.0 would mean that 100% of the light was transmitted. A value of 0.0 would mean that absolutely no light was able to get through the specimen. This spectrum was collected within the range of wavelengths that humans can perceive, which runs from roughly 400 nm (violet) to 700 nm (deep red) wavelength. (If you don’t know what I mean by wavelength, you might want to read up a bit here.)

This specimen appeared red to the human eye. The light was mostly transmitted in 650-700 nm range of wavelength, which would correspond to red and orange colors, which makes sense given how the specimen looked before I scanned it. Practically no light was transmitted below 550 nm wavelength, which means the specimen blocked blue and violet light. Somewhere in these ranges of transmitted or blocked light, we will find the information we need to categorize the color of this specimen.

## 3-Channel RGB Color

But how does this spectrum compare to RGB color? The idea behind RGB color is that 3 numbers – one each for the red, green, and blue color channels – can be used to describe almost any color visible to the human eye.

One thing is immediately apparent upon comparing our example of RGB color (255,36,0) to the spectrum from the UV/Vis spectrophotometer. The spectrum contains a great deal more information!

This brings us to the real challenge of the project: converting a continuous spectrum into RGB color values. To do that, we need to consider how the human eye perceives color, which I will discuss in my next post.