## Friday, April 12, 2013

### 6 Things You Probably Don't Know about Colour

Colour is a strage phenomenon that is fascinating to both children and adults. It's something almost every one of us reading this post would intuitively understand -- or do we really? This post asks six questions about colour, and explores the phenomenon from a mix of physiological, mathematical, and information visualization perspectives. See if any of the answers surprise you. (Disclaimer: content is rather technical. Author is a pure math grad, after all!)

1. Why are there three primary colours?

To understand this, we need to understand how we perceive colour physiologically. Visible light is electromagnetic radiation with wavelength ranging between 380nm and 740nm. Our eyes contain two different types of photoreceptor cells: cones and rods. The rod cells are very sensitive, so it is very useful for night vision. During normal daylight, though, they are overstimulated and do not contribute to vision. The cone cells is mostly responsible for colour vision, and there are three types of these cells, called S-cones, M-cones, and L-cones. Each type responds differently to light of different wavelengths: in particular S responds most strongly to blue light, M to green and L to red.

Response to light of various wavelengths, normalized

In this way, the distribution of light striking a particular area in our eyes are translated into three different signals. In other words, we perceive the colour space as a three-dimensional space. Linear algebra tells us, therefore, that there are three basis elements.

Incidentally, some humans are born without one of the three cone types, so they perceive colour as a two-dimensional space. This is of the ways people can be colour blind. Some other animals such as birds have four types of cone cells, and this is known as tetrachromacy. The mantis shrimp actually have sixteen types of cone cells!

2. Does the rainbow contain all perceivable colours?

You can probably just name some colours, like pink, that are not in the rainbow, but for the more mathematically inclined reader, here's another explanation:

Each patch of light on a rainbow has light waves of just a single wavelength, and that wavelength varies continuously from 380nm to 740nm. So think of the rainbow as a mapping from [380nm, 740nm] to the three dimensional colour space. But [380, 740] is a one-dimensional object, so following this result, there must be some colour that is not in the rainbow.

3. Can two colours look the same but be different?

Let's rephrase the question as such: can two different patches of light be composed of different combinations of wavelengths, yet be perceived to be the same? The answer is yes. A patch of light can be composed of various amount and distributions of light of different wavelengths. This is actually an infinite dimensional space, but it gets projected down to the 3D colour space when we perceive it. So some information is lost.

There are actually exhibits in science centers showing two different yellow light sources. The two yellows appear identical, but one of them is a "pure" yellow (single wavelength), and another a mixture of two or more different wavelengths. When you observer the light source through some coloured transparency that absorbs one of the "non-yellow" light, the two lights would appear different.

The two yellows may appear distinct to birds and mantis shrimps.

4. Can two colours be the same but look different?

You've probably seen the optical illusion shown here. The two shades of grey in A and B are the same shade of gray, but they appear different. What's happening?

This is where we begin moving away from the physiology of colour and towards other ways our brain has evolved to help us survive. The brain does a lot of post-processing to help us better understand the outside world, and this means that we automatically correct for artifacts like shading.

What's less obvious from this optical illusion is that your perception of colour depends on other colours nearby. For example, the grey bar below appears to be a gradient, even though it is not. This is one of the reasons why overuse of colour to represent information is discouraged from an information visualization perspective: we can interpret the information differently depending on surrounding colours.

5. Does the RGB space consist of all possible colours?

In other words, can you obtain all possible colours by mixing red, green, and blue? First of all, note that the RGB space we've been referring to is an additive colour model (as opposed to subtractive and others). Think of the additive model as mixing paint or adding light waves to be reflected, and subtractive space as absorbing certain wavelengths of light. Because we can only add light, the answer is actually no.

Chromaticity is an objective specification of the quality of a colour, regardless of its luminance (or how much light there is). On the left is a visualization of the chromaticity space, and the right the range of colours available to a typical computer monitor. Of course, everything outside of the triangle on the left side of the screen is not well represented since you're probably reading this on a monitor.

6. Why do printed colours look different from colours on a monitor?

If you ever printed a colour image, you may notice discrepancies between a printed image and the same image displayed on a monitor. Typically in printing, a CMYK colour space is used, and the possible printable colours are not identical to disable colours on the screen. Here is an example of a set of colours displayable on a screen and printable with in:

Notice that there are areas where they do not overlap. There are different ways to fix this issue, such as shrinking the RGB triangle inwards or some other continuous mapping between the two areas. Either way, the resulting may not be the same.

There are actually other issues with RGB colour space, and people do use other colour spaces for various reasons. One issue with the RGB colour space is that the amount of red, green, and blue doesn't directly tell us that much about a colour. How muted is it? How bright is it? From an information visualization perspective this matters a lot. When choosing different colours for several objects that you would like to draw equal attention to, it makes sense to make them all of similar brightness and saturation. If you want to highlight a single element, changing its brightness or saturation is one method. This is one of the reasons that HSL or HSV space is often useful.