Description
1) Chromaticity Diagrams
The text file called cie contains color matching functions in the XYZ coordinate system. The format
of the file is wavelength X Y Z from 380 nanometers to 780 nanometers. You can read it in
using:
load cie -ascii
For this problem we ask you to include your plots as well as of your Matlab commands and
interpretations.
(a) On one graph, plot the color matching functions, X(λ), Y (λ), Z(λ). On another graph, plot the
xy chromaticity diagram. Connect the “line of purples” on your diagram.
(b) In lecture 11, the conversion from the CIE RGB space to CIE XYZ space is given by the
following linear transformation:
X
Y
Z
=
0.49000 0.32000 0.2
0.17697 0.81240 0.01063
0 0.01 0.99000
RC
GC
BC
Inside the xy chromaticity diagram for CIE XYZ space, plot the triangle that corresponds to the
color gamut of the CIE RGB spectral primary system. You should use this 3×3 linear transformation
to transform the coordinates in one system to the other system.
(c) The conversion from the CIE XYZ space to the NTSC receiver primary system RN , GN , BN is
given by the following linear transformation:
RN
GN
BN
=
1.910 −0.533 −0.288
−0.985 2.000 −0.028
0.058 −0.118 0.896
X
Y
Z
The Society of Motion Picture and Television Engineers (SMPTE) made its own receiver primary
2
color coordinate system. The conversion from the CIE XYZ space to the SMPTE receiver primary
system RS, GS, BS is given by the following linear transformation:
RS
GS
BS
=
3.508 −1.741 −0.544
−1.069 1.977 0.035
0.056 −0.197 1.051
X
Y
Z
Suppose there existed two sets of phosphors which exactly corresponded to the NTSC and SMPTE
primaries. Inside the xy chromaticity diagram, plot the two triangles that correspond to the color
gamuts of these two sets of phosphors. Does it appear that the NTSC or SMPTE primaries provide
a larger gamut?
(d) On a separate plot of the xy chromaticity diagram, plot the triangle that corresponds to the color
gamut of the CIE RGB spectral primary system, in which the monochromatic spectral primaries
(Red=700nm, Green=546.1nm, Blue=435.8nm) were used for the original color matching experiment. In part (b), we already did this by using a 3×3 linear transformation to go between the CIE
XYZ and CIE RGB color systems. However, in this part you should do this (in an approximate
way) by directly using the data in the cie file.
2) Contrast and saturation enhancement for color images
Read the image PeopleWalking.jpeg into Matlab. It is of size 500 by 1110. If the image is called
”im”, you can break it into RGB color planes as follows:
>> r = im(:,:,1);
>> g = im(:,:,2);
>> b = im(:,:,3);
You can convert the RGB planes to HSI and back again using the routines rgb2hsi.m and hsi2rgb.m
which are based on the formulation from Gonzalez and Woods (except that we keep the angles in
radians, not degrees).
>> [h,s,i] = rgb2hsi(r,g,b);
The rgb2hsi routine expects inputs in the range of 0 to 255; check to be sure that your input ranges
are correct. The h,s,i outputs from it are between 0 and 1. After processing in the HSI domain, you
can convert back using hsi2rgb to obtain new RGB color planes For hsi2rgb.m, the h,s,i inputs must
be between 0 and 1. The r,g,b outputs, however, are not necessarily restricted to the range 0–255.
(a) Use Matlab’s histeq command to equalize the intensity plane ”i”. Convert back to RGB using
hsi2rgb.m. Then if the new color planes are called rHE, gHE, bHE you can put them together into
a color image using:
imHE = reshape([rHE gHE bHE], 500, 1110, 3);
3
Provide your equalized image. Where do you see shifts in hue arising in the histogram equalized
image? Give an explanation for why they occur in specific regions of the image.
(b) Going back to the HSI color planes before doing equalization, now we will try enhancing the
saturation of this picture. First try creating a new saturation plane as newS = sqrt(s). How does the
image look? Explain what you see. In particular, what happens to the woman’s white hair and white
shirt, and why does this happen?
(c) See if you can obtain more visually pleasing saturation enhancement results. Try one other
transformation function of your choice on the saturation plane. Provide your image, a plot of your
transformation function, and discussion of results.
3) Change of Reference White
We are given tristimulus values T1, T2 and T3 for a color C. The tristimulus values are relative to
a reference white W1. In other words, for our color, the tristimulus values are given by
T1(C) = A1(C)
A1(W)
T2(C) = A2(C)
A2(W)
T3(C) = A3(C)
A3(W)
You may interpret the A’s as power knob settings in the color matching experiment. What would the
new tristimulus values Tˆ
1, Tˆ
2, and Tˆ
3 be for our color C in a coordinate system that uses the same
primaries but uses a reference white W2? Derive your expression in terms of the tristimulus values
in the original coordinate system. So your expression for the Tˆ’s should involve only T’s and no A’s.
4) Adding Colors
In some color system, color C has tristimulus values T1, T2 and T3. Its chromaticity coordinates are
t1 = 0.1 and t2 = 0.1. Let W denote the reference white for the color system. We form an additive
mixture of colors: A =
1
2
(C + W). (Note: The color A is in this problem has nothing to do with
the A’s in the previous problem. Here, A represents a color.)
a) What are the tristimulus values (call them R, G, and B) for color A? What are the chromaticity
coordinates for A? (Call them r and g.)
4
b) Within the chromaticity diagram, consider the line segment that goes from the chromaticity
coordinates for C to the chromaticity coordinates for W. Show that color A is represented on
the chromaticity diagram by a point on that line segment.

