MASTERCLASS

# Color

### Lessons

#### Share

#### Transcript

Consider that we are viewing this object. It is being illuminated by a white light source and the camera is returning these RGB values or tristimulus values. Imagine now that the intensity of the white light source is being reduced. What we observe is that the appearance of the object changes but clearly the color of the object itself cannot change because the color is a material property of the object — an apple is still red, even if it is in a dark room — and what we observe is that as the lighting level has been reduced the tristimulus values have changed; they have all become smaller, but the ratio between the tristimulus values remains the same and what we would like to do is to find some way to transform the three tristimulus values to one brightness value and perhaps two color values.

One way to do this is to transform the RGB values into chromaticity coordinates and we divide the RGB values by the sum, by the total tristimulus, we end up with these variables, little R, little G and little B. And it is easy to show that these vary between zero and one. It is also easy to show that they sum to one. Therefore, one of the coordinates is redundant and typically we consider just the little R and little G values.

Consider this worked example, similar to things we have looked at before: white light falling on to a red apple and producing this tristimulus value. Now consider that there is a cloud in front of the light source, the overall illumination level has been reduced and the tristimulus value now has a different value, smaller tristimulus value then we had before. Let’s consider a worked example: in the first case we can compute the chromaticity coordinates of little R and little G. For the second case where there was a cloud in front of the light source, lower overall illumination, we can compute the chromaticity coordinates and we can see that they are the same and what we have been able to do then is to factor out the effect of intensity and retain just two numbers which provide some representation of color.

Let’s consider a two dimensional coordinate system with the axis little R and little G. This point where R equals one and G equals nought corresponds to pure red. Where R equals nought and G equals one corresponds to pure green and this point at the origin where R and G are both equal to zero corresponds to pure blue.

It is not possible for a chromaticity coordinate to exist in the space above the blue line and this comes from the constraint that little R, plus little G, plus little B has to equal one.

In an earlier lecture we discussed the concept of gamma encoding this is where there is a non-linear transformation between the brightness of the light entering the camera and the magnitude of the signal leaving the camera. Almost all cameras today have gamma encoding in them and the gamma value is typically around 2.2. What effect does gamma encoding have on chromaticity coordinates? We will illustrate this with another worked example.

We will use the tristimulus or RGB values from the earlier example with the full sun and the clouded sun illumination and the first step is to compute the gamma encoded RGB values, and they are shown here, and we can do this very easily and conveniently using MATLAB.

Now let’s compute the chromaticity coordinates and in the first case it is for the full illumination condition and here are the R and G values.

For the second case with lower illumination, we compute the chromaticity coordinates and we see they are the same as for the first case. So once again we have factored out the effect of illumination and we are left with two numbers which represent the color. For this case with gamma encoding, we have factored out the effect illumination and that is a good thing. But the actual chromaticity coordinates have a different value to the case we computed earlier without gamma encoding.

#### Code

As the illumination level changes so do the red, green and blue tristimulus values, but they are linearly related. We can separate brightness from chromaticity which is a two dimensional representation of color. We discuss briefly the effect of gamma encoding on the color reproduction process.

### Skill level

High school mathematics

This content assumes an understanding of high school-level mathematics, e.g. trigonometry, algebra, calculus, physics (optics) and some knowledge/experience of programming (any language).