\documentclass[a4paper,11pt]{article}

% Definitions for the document
\def \Course {Interactive Computer Graphics }
\def \LectureNo {3}
% font definitions used in vector algebra
\newcommand{\Vector}[1]{\mathbf{#1}}
\newcommand{\UVector}[1]{\textbf{\em #1}}
\newcommand{\Matrix}[1]{\mathcal{#1}}
% standard layout for Duncan's lecture notes and tutorial material
\usepackage[margin=2cm, nohead]{geometry}
\usepackage{times}
\usepackage{wrapfig}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{amsmath}
\usepackage{amsfonts}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\headrulewidth}{0pt}
\lfoot{\footnotesize{\Course Tutorial \LectureNo}}
\rfoot{\footnotesize{\thepage}}
% end of standard layout

\begin{document}

\section*{Tutorial \LectureNo: Colour}

A colour is defined by the following three tri-stimulus intensities obtained during a colour matching experiment:
\begin{equation}
\nonumber
 r = 3 \indent   g = 3 \indent  b = 6
\end{equation}
1. What is its $(x, y)$ coordinate on the CIE diagram? \\
\newline
2. Plot this point on the CIE diagram.  Construct a line on the CIE diagram to obtain a measurement of: \\
\begin{enumerate}
\renewcommand{\theenumi}{\roman{enumi}}
\item The wavelength of the corresponding pure hue
\item The wavelength of the complement of its pure hue
\item The $(x, y)$ coordinate of the corresponding pure hue
\item The saturation of the colour.
\end{enumerate}
3. A monitor is calibrated and the three phosphors have the following CIE diagram coordinates: \\
\begin{tabular}[]{l c c}
      &  x    &  y     \\
Red   &  0.62 &  0.34  \\
Green & 0.27  & 0.59   \\
Blue  & 0.15  & 0.07   \\
\end{tabular} \\
\newline
Plot the area of colours that can be displayed by the monitor on your CIE diagram
\newline
\begin{center}
    \includegraphics[width=130mm]{Figures/GraphicsColourCIEDiagram.jpg} 
\end{center}
\newpage
\noindent
4. The monitor is driven by a computer system that represents colours by RGB values in the range [0, 255]. Find the matrix that will convert $(r, g, b)$ values into $(x, y, z)$ coordinates. \\
\newline
5. The inverse of the matrix of Q4 should be approximately:
\begin{equation}
\nonumber
\left(
  \begin{array}{  c c c  }
      542 & -228 & -84  \\
     -316 & 574  & 9    \\
       29 & -91 & 330  \\
  \end{array}
\right)
\end{equation}
You can use this to check your result in Q4.\\
\newline
Compute the RGB values that would be used to represent the original colour defined in Q1.\\
\newline
6. Using the RGB result from part 5 calculate the corresponding HSV values of the colour.\\
\newline
7. A colour given by point $x=0.1$, $y=0.2$ on the CIE diagram cannot be represented by the light sources of the monitor. How could a light source of this colour be calibrated by subtractive matching, using light sources with the same coordinates as the monitor. 
\newpage
\section*{Tutorial \LectureNo:  Solution}
Q1.
\begin{equation}
 \nonumber
x=\frac{r}{r+g+b} = 0.25 \indent y=\frac{g}{r+g+b} = 0.25
\end{equation}
Q2.  In the CIE plot below, the point $U$ represents $(x, y) = (0.25, 0.25)$.  The white point is $W$.
\begin{enumerate}
\renewcommand{\theenumi}{\roman{enumi}}
\item The point representing the pure hue is P, wavelength 388
\item The complement is point C, wavelength 575
\item (0.08,0.09)
\item The saturation is the ratio of the distances: $WU/WP \approx 0.335$
\end{enumerate}
\begin{center}
    \includegraphics[width=90mm]{Figures/GraphicsColourTutorial01.jpg} 
\end{center}
Q3.  With the values given, the monitor can display colours inside the triangle shown below.
\begin{center}
    \includegraphics[width=90mm]{Figures/GraphicsColourTutorial02.jpg} 
\end{center}
Q4.  The RGB values need to be normalised in the range [0, 1] and, using the CIE coordinates for the monitor’s three phosphors, the transformation from $(r, g, b)$ to $(x, y, z)$ is given as follows:
\begin{equation}
\nonumber
\left(
  \begin{array}{ c}
      x  \\
      y  \\
      z  \\
  \end{array}
\right) = \frac{1}{255}
\left(
  \begin{array}{  c c c  }
      0.62 & 0.27 & 0.15  \\
      0.34 & 0.59 & 0.07  \\
      0.04 & 0.14 & 0.78  \\
  \end{array}
\right)
\left(
  \begin{array}{ c}
      r  \\
      g  \\
      b  \\
  \end{array}
\right)
\end{equation}
We can multiply the constant into the matrix to get:
\begin{equation}
\nonumber
\left(
  \begin{array}{ c}
      x  \\
      y  \\
      z  \\
  \end{array}
\right) = 
\left(
  \begin{array}{  c c c  }
      0.0024 & 0.0011 & 0.0006  \\
      0.0013 & 0.0023 & 0.0003  \\
      0.0002 & 0.0005 & 0.0031  \\
  \end{array}
\right)
\left(
  \begin{array}{ c}
      r  \\
      g  \\
      b  \\
  \end{array}
\right)
\end{equation}
Q5.  The RGB values are approximately (37, 69, 150):
\begin{equation}
\nonumber
\left(
  \begin{array}{  c c c  }
      542 & -228 & -84  \\
     -316 & 574  & 9    \\
       29 & -91 & 330  \\
  \end{array}
\right)
\left(
  \begin{array}{  c   }
     0.25  \\
     0.25    \\
     0.5  \\
  \end{array}
\right) \approx
\left(
  \begin{array}{  c }
     37  \\
     69    \\
      150  \\
  \end{array}
\right)
\end{equation}
Q6. 
\begin{equation}
\nonumber
V = max(r,g,b) = 150
\end{equation}
\begin{equation}
\nonumber
S = \frac{max(r,g,b) - min(r,g,b)}{max(r,g,b)} = \frac{150-37}{150} \approx 0.75
\end{equation}
To find $H$, note that we have $g < r$ and $b < r$ so
\begin{equation}
\nonumber
H = 120 + 120 \times \frac{(b-r)}{(g-r)+(b-r)} = 120 + 120 \times \frac{(150-37)}{(69-37)+(150-37)} \approx 215
\end{equation}
Q7.  First we find out what the corresponding RGB values would be:
\begin{equation}
\nonumber
\left(
  \begin{array}{  c c c  }
      542 & -228 & -84  \\
     -316 & 574  & 9    \\
       29 & -91 & 330  \\
  \end{array}
\right)
\left(
  \begin{array}{  c   }
     0.1  \\
     0.2  \\
     0.7  \\
  \end{array}
\right) \approx
\left(
  \begin{array}{  c }
     -50  \\
      90    \\
      216  \\
  \end{array}
\right)
\end{equation}
Since the red component is negative we can mix light from the red source (intensity 50) with the given test colour to obtain a match. The matching will be done with a mixture of green (intensity 90) and blue (intensity 216).

\end{document}