
\documentstyle[12pt]{article}
%\setlength{\textheight}{8.5in}
%\textwidth 6.0in
%\setlength{\topmargin}{-0.4in}
%\tolerance 2000
\usepackage{html}
\begin{document}


\htmladdimg{../figures/color_illusion_1.gif}

\section*{What Determines the Colors We See?}

Is color a property of the external world?  Are the surfaces in the external 
world labeled by colors for the eye and brain to see {\em passively}? Or is 
color a property of the brain, which {\em actively} constructs the colors of 
the surfaces from the information received from the external world? In other
words, is color the cause or the consequence of our visual perception? These 
questions are at the interface of biology and physics, and even of philosophy.
We will address them later by answering what determines the color we see. 

Due to these questions, we need be careful about how the word ``color'' is 
used. In the following, the word color may be used in two different ways: to 
indicate the energy spectral distribution $L(\lambda)$ of a light signal the
eye receives (better described by the word {\em light}), or to represent the
corresponding visual perception, the color we see. This distinction is 
necessary simply because spectral distribution $L(\lambda)$ is not the only
factor that determines what color we perceive, an important point to be 
discussed later.


\subsection*{Light -- The Electromagnetic Signal}

Along the visible band (350 nm -- 780 nm) (1 nanometer=$10^{-9}$ meter) of the
electromagnetic spectrum, there are only about 128 fully saturated colors that
can be distinguished by the human eye. It is the spectral composition, the
energy spectral distribution $L(\lambda)$ of the light that is the signal the 
eye receives for the brain to process. Sometimes $L(\lambda)$ may be referred
to as the color, but this is to be distinguished from the actual color we
perceive from this light, because the energy spectral distribution is not the
only factor that determines the perceived color, as we will discuss later.

Newton's experiments and contributions (1704):
\begin{itemize}
\item	Decomposition of white light by a prism into many spectral lights,
	and reconstruction of a white light from the spectral lights by a
	second prism; A spectral light can not be further decomposed.
\item 	A spinning round plate with sections painted in different colors would
	look white;
\item 	Realization that perception of color is caused by the spectral 
	composition of the light.
\end{itemize}

\htmladdimg{../figures/newtondrawing.gif}

\htmladdimg{../figures/Color_spectrum_1.gif}

\htmladdimg{../figures/Color_spectrum_2.gif}

\htmladdimg{../figures/sunspectrum.gif}

\subsection*{Superposition of Lights}

If the component waves of a beam of light of a single frequency have a fixed 
phase relationship with each other, the light is {\bf coherent} (e.g., the 
laser). Two beams of light are coherent if the phase difference between their
waves is constant. For example, two beams produced by splitting a single laser
beam are coherent and they form stable interference patterns when combined. 
On the other hand, a light is non-coherent if its component waves have a 
random or changing phase relationship, such as light produced by an 
incandescent light bulb.

The intensities of incoherent lights add linearly, i.e., the spectral energy 
distribution of the mixture of two lights is the linear combination of their 
individual energy distributions. In other words, the spectral energy 
distribution of the mixture of a set of $n$ lights with intensities
 $c_i,\;\;(i=1,\cdots, n)$ is the weighted sum of their individual
spectral distributions $L_i(\lambda),\;\;\;(i=1,\cdots,n)$: 
\[	L_{mixture}(\lambda)=\sum_{i=1}^n c_i L_i(\lambda)	\]


\subsection*{The Physics of Lighting}

	Planck (1900) formulated the relationship between the temperature
	and the spectral energy distribution in the {\bf radiation} of a
	blackbody (a hypothetical body that completely absorbs all radiant 
	energy falling upon it, reaches some equilibrium temperature, and
	then re-emits that energy as quickly as it absorbs it) 
\[	R(\lambda)=\frac{8 \pi h c}{\lambda^5 [exp(hc/k T \lambda)-1]}	\]
	where $c$ is the speed of light, $\lambda$ is the wavelength, $T$
	is the temperature, $h$ is the Planck constant and $k$ is the
	Boltzmann constant. 
	
	As examples, the energy spectral distribution of several light
	sources, the direct sun light, the overcast sky, and a tungsten
	filament lamp are plotted.

	While an object is illuminated by a light source, what the eye
	perceives is the light reflected by the surface of the object:
\[	L(\lambda)=R(\lambda) I(\lambda)	\]
	$L(\lambda)$ depends on both the {\bf illumination} $I(\lambda)$
	and the {\bf reflectance} of the object $R(\lambda)$. Typically the
	illumination has little spatial variation, while the reflectance may
	have drastic spatial changes representing the details (texture,
	color, smoothness, etc.) of the object surfaces.

% figure on page 294 of Wandell...


\section*{Color Matching and Trichromatic Theory}

This theory emerged over the eighteenth century which basically states that 
any color $L(\lambda)$ can be reproduced by mixing appropriate amounts of 
three primary colors with energy distributions $P_j(\lambda),\;\;(j=1,2,3)$ 
provided the wavelengths are far enough apart. For example, red, green, and 
blue. As we will see later, ``far enough apart'' means mathematically the 
spectral energy distributions of the three colors are linearly independent.

\subsection*{The Color Matching Experiment}

The goal of an additive color matching experiment is to superimpose 
appropriate amounts of the three primaries $P_j\;\;\;(j=1,2,3)$ so that the 
resulting color $L'$ is perceived the same as a given color $L$. This can be
actually carried out by three projectors that project the three primary colors 
with adjustable intensities on a screen.

This process is symbolically represented by
\[	[L] \equiv [L'] = A_1(L) [P_1] + A_2(L) [P_2] + A_3(L) [ P_3]	\]
This is not a mathematical equation in the normal sense, as the symbols used 
here have special meanings:
\begin{itemize}
\item 	Anything inside a pair of brackets (e.g., $[L]$ or $[P_j]$) is a 
	color (an arbitrarily given color or a primary color) of certain 
	energy spectral distribution;
\item	$A_j(L)$ is a scaler coefficients representing the amount of a primary
	color $P_j$ needed to match the given color $L$;
\item	The symbol $+$ represents the actual mixing of the colors by 
	projecting them on the same screen.
\item	The symbol $\equiv$ means the color on the left-hand side is 
	equivalent to that on the right-hand side in the sense that they are
	perceived by the human eye as the same color. (But this does not mean 
	that the two energy distributions are necessarily the same, as 
	discussed later.) 
\end{itemize}

	As we are usually concerned with the proportions of the color mixing
	but not the absolute intensities, the color matching process can be 
	normalized by using a reference white color $W$. The amount of primary
	$P_j$ needed to match $W$, represented by $A_j(W)$, is used to 
	normalize the intensity $A_j(L)$ for matching $L$:
\[	T_j(L)=\frac{A_j(L)}{A_j(W)}\;\;\;\;(j=1,2,3)	\]
	The $T_j(L)$'s are called the {\em tristimulus values}.


\subsection*{Negative Tristimulus Values}

Sometimes when it is impossible to match a color $L$ by superimposing (mixing)
the given primaries $P_j,\;\;\;(j=1,2,3)$ as described above, it is possible 
to still match the color in a different way. For example, the mixture of one 
or two primaries with the given color $L$ may be matched by the mixture of 
the remaining primaries:
\begin{itemize}
\item {\bf Mixing one primary with the given color}
\[	[L] + A_1(L) [P_1] \equiv A_2(L) [ P_2 ]+ A_3(L) [ P_3]	\]
	with the tristimulus values correspondingly defined as
\[	T_1(L)=\frac{-A_1(L)}{A_1(W)}\;\;\;\;\;\;
	T_2(L)=\frac{A_2(L)}{A_2(W)}\;\;\;\;\;\;
	T_3(L)=\frac{A_3(L)}{A_3(W)}
\]
\item {\bf Mixing two primaries with the given color}
\[	[L] + A_1(L) [ P_1] + A_2(L) [ P_2 ]\equiv  A_3(L) [ P_3 ]	\]
	with the tristimulus values correspondingly defined as
\[	T_1(L)=\frac{-A_1(L)}{A_1(W)}\;\;\;\;\;\;
	T_2(L)=\frac{-A_2(L)}{A_2(W)}\;\;\;\;\;\;
	T_3(L)=\frac{A_3(L)}{A_3(W)}
\]
\end{itemize}


\subsection*{Axioms of Color Matching}
Based on the observations of many color matching experiments, Grassman (1854)
summarized a set of eight axioms:
\begin{enumerate}
\item Any color can be matched by a mixture of no more than three colors.
\item A color match at one radiance level holds over a wide range of levels.
\item Components of a mixture of colored lights cannot be resolved by the 
	human eye.
\item The luminance of a color mixture is equal to the sum of the luminance of
	its components.
\item Law of addition --- if color M matches color N and color P matches color
	Q, then color M mixed with color P matches color N mixed with color Q:
\[	[M] \equiv [N],\;\;[P] \equiv [Q]\;\;\Rightarrow \;\;
	[M]+[P] \equiv [N]+[Q]	\]
\item Law of subtraction --- if the mixture of M and P matches the mixture
	of N and Q, and if P matches Q, then M matches N:
\[	[M]+[P] \equiv [N]+[Q],\;\;\;\; [P] \equiv [Q],\;\;
	\Rightarrow \;\;[M] \equiv [N] \]
\item Transitive law --- if M matches N and N matches P, then M matches P:
\[	[M] \equiv [N],\;\;\;[N] \equiv [P] \;\;\;\Rightarrow\;\; [M] \equiv [P]	\]
\item Color matching --- a given color $L$ can be matched in one of three ways:
	\begin{enumerate}
	\item 
	\[ [L] \equiv A_M [M] + A_N [N] + A_P [P] \]
	\item 
	\[ [L] + A_M [M] \equiv A_N [N] + A_P [P] \]
	\item 
	\[ [L] + A_M [M] + A_N [N] \equiv A_P [P] \]
	\end{enumerate}

\end{enumerate}

The 8th axiom is a summary of the color matching experiments discussed 
previously. Because the principle of superposition holds in color mixing,
we can re-write a color match
	\[ [L] \equiv A_1(L) [P_1] + A_2(L) [P_2] + A_3(L) [P_3] \]
as 
\[L(\lambda) \equiv A_1(L) P_1(\lambda)+A_2(L) P_2(\lambda)+A_3(L) P_3(\lambda)
	=\sum_{j=1}^3 A_j P_j(\lambda)	\]
	
Again, the symbol $\equiv$ represents that the energy spectral distributions
on both sides are perceived as the same by the human eye, but as functions of
wavelength $\lambda$, they are not identical in general.



\newpage
\section*{Photoreceptors and Perception of Color}

\subsection*{Sensitivity functions}

To explain the trichromatic theory, Thomas Young (1802) first postulated that 
at each point in the retina there must exist at least three tiny structures 
that are sensitive to red, green and violet. This theory was adopted and
championed by Hermam von Helmholtz and came to be known as the Young-Helmholtz
theory.

This theory was confirmed later by modern physiology. In the visual system of 
the primates, there are two types of photoreceptor cells called rods and cones.
Rods are very sensitive to light and can respond to just a few photons. But 
the cones need significantly brighter light. There are three types of cone 
cells (called the S type, M type, and L type) with different sensitivities,
responding to short, medium, and long wavelengths. Color vision is the result
of these three types of cone cells. See
\htmladdnormallink{here}{http://en.wikipedia.org/wiki/Photoreceptor_cell}
for more detailed discussions about these photoreceptor cells.

The physical intensity measurements of the electromagnetic energy distribution
is related to the perceptual brightness and color by the scotopic (dim light
mediated by the rods) and the photopic (bright light mediated by the cones)
sensitivity or luminosity functions $S(\lambda)$. Specifically, the magnitude
of the response of a photoreceptor (the firing rate) is determined by how much
light is, or more specifically, how many photons are, absorbed by the 
photopigment of the photoreceptors. The more light a receptor catches, the 
stronger its response will be, and the more sensitive the receptor becomes.
This property of the photoreceptors can be represented by its photon capture 
rate (number of photons absorbed per unit time), or its sensitivity,
%These two different but related...
denoted by $S(\lambda)$ as a function of wavelength $\lambda$. The sensitivity
functions of the three types of cone cells can be denoted by 
$S_i(\lambda)\;\;\;(i=1,2,3)$ which peak approximately at 560 nm, 530 nm and 
430 nm respectively, as shown.

If the light received by the retina is $L(\lambda)$, then the response of a
photoreceptor is proportional to the total number of photons absorbed, which
can be obtained by 
\[ r=\int S(\lambda) L(\lambda) d\lambda \]

\htmladdimg{../figures/EyeFig.png}
\htmladdimg{../figures/RodCone1.png}
\htmladdimg{../figures/RodCone2.png}
\htmladdimg{../figures/receptortuningcurve.gif}
\htmladdimg{../figures/RodSensitivity.png}
\htmladdimg{../figures/ConeSensitivity.png}



\subsection*{Comparison --- Necessary Condition for Color Vision}

\begin{itemize}
\item \htmladdnormallink{{\bf Monochromatic System}}{http://en.wikipedia.org/wiki/Monochromacy}:

  If there is only one type of photoreceptors with sensitivity as a function of
  wavelength $S(\lambda)$, such as the rod cells in the retina, then only one 
  value is produced as the response to a given color $L(\lambda)$ (see
  \[	r=\int S(\lambda) L(\lambda) d\lambda \]
  and the visual system perceives an image of different gray levels.
  Moreover, it is possible that some two colors $L(\lambda)$ and $L'(\lambda)$
  are responded to by the same value, so long as
  \[ r=\int S(\lambda) L(\lambda) d\lambda=
  r'=\int S(\lambda) L'(\lambda) d\lambda	\]
  \htmladdimg{../figures/MonoChromatic.png}

\item \htmladdnormallink{{\bf Dichromatic System}}{http://en.wikipedia.org/wiki/Dichromacy}:

  The necessary condition for color perception is to have more than one type
  of photoreceptor with different sensitivity functions $S_i(\lambda)\;\;\;
  (i=1,2)$, so that each color is represented by two or more values and some
  {\em comparison} can be made between the two types of receptors. 

  Almost all mammals except primates have only two types of photoreceptors
  (S type and LM type). It is again possible, although less likely than the 
  monochromatic case, for two colors $L(\lambda)$ and $L'(\lambda)$ to be 
  indistinguishable if the two types of receptors respond to the colors in 
  the same way, i.e.,
  \[ r_i=\int S_i(\lambda) L(\lambda) d\lambda
  =r'_i=\int S_i(\lambda) L'(\lambda) d\lambda\;\;\;\;(i=1,2)	\]

  \htmladdimg{../figures/DiChromatic.png}

\item \htmladdnormallink{{\bf Trichromatic System}}{http://en.wikipedia.org/wiki/Trichromacy}:

  In the primates the LM type photoreceptor is separated into M and L types.
  These three different types of photoreceptors respond to a given color
  $L(\lambda)$ with different intensities:
  \[	r_i=\int S_i(\lambda) L(\lambda) d\lambda\;\;\;\;(i=1,2,3) \]
  As the result, more comparisons can be made to distinguish more colors. 
  But can three types of receptors resolve all possible colors? As before,
  if it so happens that all three types of receptors respond to some two colors
  $L(\lambda)$ and $L'(\lambda)$ with identical outputs:
  \[ r_i=\int S_i(\lambda) L(\lambda) d\lambda
  =r'_i=\int S_i(\lambda) L'(\lambda) d\lambda\;\;\;\;(i=1,2,3)	\]
  the colors are still indistinguishable, and they are called 
  \htmladdnormallink{{\em metamers}}{http://en.wikipedia.org/wiki/Metamerism_(color)}.

  \htmladdimg{../figures/TriChromatic.png}

  %\htmladdimg{../figures/colorsensors.gif}

\item \htmladdnormallink{{\bf Tetrachromatic System}}{http://en.wikipedia.org/wiki/Tetrachromacy}:

  Some animals have four different types of photo receptors that are sensitive 
  to red, green, blue and ultraviolet light. These animals have much richer
  color sensation than humans.
\end{itemize}

\subsection*{How to distinguish all colors?}

From the fact that the trichromatic system can distinguish more colors than the
dichromatic system, which in turn can distinguish more colors than the monochromatic
system, it seems obvious that the more different types of photoreceptors the 
vision system has, the more values are available to represent a color, and the
more comparisons can be made to distinguish more colors. As trichromatic system
still cannot tell all possible colors apart, how many different types of receptors
are necessary to do so?

The key here is to be able to uniquely represent in the visual system the 
energy spectral distribution $L(\lambda)$ of an incoming light, which determines
the physical property of the light (but not necessarily its perceived color). To 
approach the problem, we discretize the continuous spectral distribution $L(\lambda)$
by approximating it by $m$ values $L(\lambda_j),\;\;(j=1, \cdots, m)$, each 
representing the energy contained in one of $m$ segments of the distribution. Now 
the response of the $ith$ receptor to the light becomes
\[
r_i=\int S_i(\lambda) L(\lambda) d\lambda \approx \sum_{j=1}^m S_i(\lambda_j)L(\lambda_j)
\;\;\;\;(i=1, \cdots, n)
\]
where $m$ is the number of segments used to approximate the spectral distribution
and $n$ is the number of different types of receptors. To obtain the spectral
distribution $L(\lambda_j),\;\;(j=1, \cdots, m)$ from the receptor responses 
$r_i,\;\;(i=1, \cdots, n)$ available in the visual system, it is mathematically
obvious that $n$ has to be equal to $m$ so that we have $n=m$ equations which 
can be solved to uniquely determine the $m$ unknowns $\L(\lambda_j)$.

The number $m$ of discrete values $L(\lambda_j)$ depends on the details of the 
spectral distribution of the incoming lights, and usually $m$ needs to be much
greater than $3$ to describe the various distributions of the incoming lights. 
This is why $n=3 \ll m$ types of receptors are not enough to tell all colors apart. 


\newpage
\subsection*{Color Mixing I: Red + Green = Yellow}

To show that three types of receptors cannot resolve all possible colors, we
consider, for example, three spectral (monochromatic) colors:
\begin{itemize}
\item  {\bf Red:}
\[	L_r(\lambda)=\delta(\lambda-\lambda_r)	\]
where $\lambda_r=615$ nm;
\item  {\bf Yellow:}
\[	L_y(\lambda)=\delta(\lambda-\lambda_y)	\]
where $\lambda_y=565$ nm;
\item  {\bf Green:}
\[	L_g(\lambda)=\delta(\lambda-\lambda_g)	\]
where $\lambda_g=490$ nm;
\end{itemize}
As shown in the figure, the responses of the L and M (red and green) cones
to color $L_y(\lambda)=\delta(\lambda-\lambda_y)$ are the same as their 
responses to the mixed color 
\[	L_{rg}(\lambda)=L_r(\lambda)+L_g(\lambda)
	=\delta(\lambda-\lambda_r)+\delta(\lambda-\lambda_g)	\]
as
\[	r_i=\int S_i(\lambda) L_y(\lambda) d\lambda
	=\int S_i(\lambda) L_{rg}(\lambda) d\lambda \;\;\;\;(i=L, M) \]
So colors $L_y(\lambda)$ and $L_{rg}(\lambda)$ cannot be distinguished by
our visual system. That is why ``red plus green is yellow''.

% (In fact, in this particular case, these two colors should still be
% distinguishable as the S type receptors respond them differently.)

%\htmladdimg{../figures/Color_primary.gif}
\htmladdimg{../figures/red_yellow_green.gif}

\newpage
\subsection*{Why do we only have three types of receptors?}

From our earlier discussion, it is obvious that the more types of receptors
we have (the greater the number $n$), the higher the resolution of our 
internal representation of the energy spectral distribution of the light signal,
and the more colors that can be distinguished. Then the question is, why didn't
our visual system evolve to have more than $n=3$ different types of receptors for
uniquely distinguishing more colors?

In our auditory system, we do have many different types of detectors each 
tuned to respond most optimally a narrow range of frequencies. And similarly 
in our smell and taste sensory systems there are many different types of
detectors each for detecting a particular smell or taste. But why don't we 
have many more types of retina cone cells ($n \gg 3$) each for one particular
band of wavelength? 

The answer to this question is obvious if we consider the cost. We should
realize that vision takes place in a two-dimensional visual field (the surface
area of the retina), compared to other senses such as hearing and smell which
essentially take place at a point (of zero dimension). In order to be able to
sense the color of every position in the 2D field by a set of $n \gg 3$ 
detector, there would have to be many such receptors, too many to be possibly
contained in the retina of limited area. Moreover, the brain would also have 
to processing much more visual information coming from the receptors in the 
eye. 

But due to the comparison among the three types of receptors we do have, we 
perceive many more different colors than just the three colors of red, green
and blue. All these different colors are represented internally in our brain
as different ratios between the three types of sensors or neurons tuned for 
the three primary colors. In other words, there are not ``grandmother cells''
each for a different color. Instead, a specific color is represented internally
by a set of basic features, the three primary colors. During the long process
of evolution, Nature made an optimal tradeoff between the performance (number
of colors we perceive) and the cost (number of receptors needed for the task)
by having three types of receptors to see many more colors than most of the
animals. 

\newpage
\subsection*{Color Mixing II: ``Yellow + Blue = Green''}

Most children know the mixture of blue and yellow paints looks green. But why?
Does this also mean that the mixture of blue light and yellow light also looks
green? If not, what color should the mixture of these lights look like and why?

Helmholtz was the first to explain why the mixture of yellow and blue paints 
looked green. To answer these questions, we should first understand why paints
have different colors. A red paint on a white paper does not reflect extra 
red light than the paper without the red paint. Instead, the red paint {\em 
absorbs} all other colors than red. In general, the paints act as band-pass 
filters allowing only frequencies in a certain range to pass. On the other 
hand, a red light has most of its energy distributed in the frequency band of
red light. In other words, the spectral distribution of a mixture of lights is
the sum (or union) of the spectral distributions of the individual lights (a 
logic OR), while the spectral distribution of a mixture of paints is the 
intersection of the distributions of the individual paints (a logic AND). As a
simple example, we easily see that the mixture of paints of all colors looks
black, while the mixture of lights of all colors looks white.

Going back to the problem of yellow plus blue, if we are mixing paints, the 
intersection of the spectral distributions of these two paints (assuming they
are wide enough) is in the frequency range for green. But if we are mixing 
lights, then the sum of the two distributions, if wide enough, may be as wide
as to cover most of the visible visible frequency range so that the mixture 
may look light gray.

\htmladdimg{../figures/Color_YplusB.gif}


In the previous red-plus-green case, if we were mixing paints instead of 
lights, the mixture may look dark bluish, as both the red and green components
of the white light are absorbed.

\htmladdimg{../figures/Color_blue_yellow.gif}

\newpage
\section*{Trichromatic Theory Revisited}

\subsection*{Theory of Color Matching}

Now we can revisit the color matching issue, and discuss the real meaning
of the equivalent symbol $\equiv$. 

The visual system and the color system are described by
\begin{itemize}
\item {\bf The Visual System: } The three types of photoreceptors with 
	sensitivities $S_i(\lambda),\;\;(i=1,2,3)$;
\item {\bf The Color System: } The three primaries with energy spectral 
	distributions $P_j(\lambda),\;\;(j=1,2,3)$ together with the 
	reference white $W(\lambda)$.
\end{itemize}

We want to match a given color $L(\lambda)$ with another color produced by 
mixing the three primaries 
\[	L'(\lambda)=\sum_{j=1}^3 A_j(L) P_j(\lambda)	\]
with proper weights or intensities $A_j(L),\;\;(j=1,2,3)$.

Since color matching now means specifically that the three types of
photoreceptors have the same responses to the two colors, we must require
\begin{eqnarray}
	&   & r_i(L) = \int L(\lambda) S_i(\lambda) d\lambda \nonumber \\
	& = & r_i(L')= \int L'(\lambda) S_i(\lambda) d\lambda  
	 = \int [ \sum_{j=1}^3 A_j(L) P_j(\lambda) ] 
		S_i(\lambda) d\lambda \nonumber \\
	& = & \sum_{j=1}^3 A_j(L) \int S_i(\lambda)P_j(\lambda)d\lambda 
	 = \sum_{j=1}^3 A_j(L) a_{ij}\;\;\;(i=1,2,3)	\nonumber
\end{eqnarray}
where $a_{ij}$ is defined as the response of the ith photoreceptors to the jth
primary:
\[	a_{ij}\stackrel{\triangle}{=}r_i(P_j)=
	\int S_i(\lambda)P_j(\lambda) d\lambda \;\;\;\;\;(i,j=1,2,3)	\]
The three equations above can now be rewritten to obtain the {\em color
matching equations}:
\[	\sum_{j=1}^3 a_{ij} A_j(L) =\int S_i(\lambda) L(\lambda) d\lambda
	\;\;\;(i=1,2,3)	\]
Solving this set of three simultaneous equations, we get the three coefficients
$A_j(L),\;\;(i=1,2,3)$, the weights for mixing the three primaries to produce
color $L'(\lambda)=\sum_j A_j(L) P_j(\lambda)$, which will be perceived the 
same as the given color $L(\lambda)$:
\[	L(\lambda) \equiv L'(\lambda)=\sum_{j=1}^3 A_j(L) P_j(\lambda) \]
However, we note that these two functions do not equate mathematically in
general, i.e., they are different energy spectral distributions:
\[	L(\lambda) \neq L'(\lambda)=\sum_{j=1}^3 A_j(L) P_j(\lambda) \]

In general if the three types of photoreceptors' responses to two colors 
$L_1(\lambda)$ and $L_2(\lambda)$ are the same, i.e.,
\[	r_i(L_1)=\int L_1(\lambda) S_i(\lambda) d\lambda=
	r_i(L_2)=\int L_2(\lambda) S_i(\lambda) d\lambda\;\;\;(i=1,2,3)	\]
then the two colors are indistinguishable and are called {\em metamers}.
There are infinitely many possible metameric spectral energy distributions 
that cause the same responses in the visual system.

\newpage
\subsection*{Calibration with a Reference White}

The absolute magnitudes of the weights $A_j(L)$ is directly affected by the 
intensity of the given color $L(\lambda)$. To calibrate various intensities,
we normalize $A_i(L)$'s by comparing them against a reference white light 
source $W(\lambda)$.

As discussed before, we define the {\em tristimulus values} of a given color 
$L$ as
\[	T_j(L)=\frac{A_j(L)}{A_j(W)}\;\;\;\;\;(j=1,2,3)	\]
where $A_j(W)$'s are the weights for the three primaries to match the 
reference white $W(\lambda)$. $A_j(W)$'s can be obtained by solving the
matching equations for the reference white:
\[	\sum_{j=1}^3 a_{ij} A_j(W) = \int S_i(\lambda) W(\lambda) d\lambda 
	\;\;\;(i=1,2,3)	\]
In particular, the tristimulus values for the reference white itself is
always 1:
\[ T_j(L)|_{L=W}=\frac{A_j(L) |_{L=W}}{A_j(W)}=\frac{A_j(W)}{A_j(W)}=1	\]
Now the color matching equations for an arbitrary color $L(\lambda)$ become
\[	\sum_{j=1}^3 a_{ij} A_j(L) =\sum_{j=1}^3 a_{ij} T_j(L) A_j(W) 
	=\int S_i(\lambda)L(\lambda) d\lambda\;\;\;(i=1,2,3)	\]
Solving these equations, we can get $T_j(L),\;\;(j=1,2,3)$ for matching any
given color $L(\lambda)$.

\newpage
\subsection*{Spectral matching curves}

If the color to be matched is a spectral color of a single wavelength 
$\lambda'$ with unit energy:
\[	L(\lambda)=\delta(\lambda-\lambda')	\]
the matching equations become
\[	\sum_{j=1}^3 A_j(W) T_j(\lambda') a_{ij}
	=\int S_i(\lambda)\delta(\lambda-\lambda') d\lambda
	= S_i(\lambda')  \;\;\;(i=1,2,3)	\]
Solving these three simultaneous equations we can get the tristimulus values 
$T_j(\lambda')\;\;\;(i=1,2,3)$ for the given spectral color 
$\delta(\lambda-\lambda')$. As functions of wavelength $\lambda$, these
$T_j(\lambda)$'s are called the {\em spectral matching curves} representing
amount of each primary needed to match a flat spectral distribution.

The spectral matching curves can also be used to obtain tristimulus values 
$T_j(L)$ for any given color $L(\lambda)$. To see this, we substitute
\[	S_i(\lambda)=\sum_{j=1}^3 A_j(W) T_j(\lambda) a_{ij}	\]
into the color matching equations to get
\[	\sum_{j=1}^3 a_{ij} A_j(W) T_j(L) 
	=\int S_i(\lambda) L(\lambda) d\lambda
	=\sum_{j=1}^3 A_j(W) a_{ij} \int T_j(\lambda) L(\lambda) d\lambda
\]
As this equation holds for all three types of cells (i=1,2,3), we see that 
\[	T_j(L)=\int L(\lambda)T_j(\lambda) d\lambda\;\;\;\;(j=1,2,3)	\]
the tristimulus values for matching any color $L(\lambda)$ can be easily 
obtained from the spectral matching curves $T_j(\lambda)$.

\newpage
\subsection*{CIE's Spectral RGB Primaries}

As an example, we want to find the spectral matching curves using a particular
set of primaries composed of monochromatic (spectral) red, green blue, as 
recommended by the Commission Internationale de l'Eclairage (CIE):
\begin{itemize}
	\item Red: $P_1(\lambda)=\delta(\lambda-\lambda_1)$, where 
5		$\lambda_1=700$ nm;
	\item Green: $P_2(\lambda)=\delta(\lambda-\lambda_2)$, where 
		$\lambda_2=546.1$ nm;
	\item Blue: $P_3(\lambda)=\delta(\lambda-\lambda_3)$, where 
		$\lambda_3=435.8$ nm.
\end{itemize}
and the CIE reference white defined by a flat spectral distribution:
\[	W(\lambda)=1	\]

To find the spectral matching curves, we first find $a_{ij}$, the response of
the ith type of cones to the jth primary:
\[	a_{ij}=r_i(P_j)=
	\int S_i(\lambda) \delta(\lambda-\lambda_j) d\lambda=S_i(\lambda_j)
\]
We next find the weights $A_j(W)$ to match the CIE reference white by solving
the color matching equations for the reference white
\[	\sum_{j=1}^3 A_j(W) T_j(W) a_{ij} =
 \int S_i(\lambda) W(\lambda) d\lambda = \int S_i(\lambda) d\lambda \]
where $T_j(W)=1$, as noted before.

Now we substitute these $A_j(W)$ $(j=1,2,3)$ and $a_{ij}=S_i(\lambda_j)$ into
the matching equations for a spectral color $\delta(\lambda-\lambda')$ to get

\[	\sum_{j=1}^3 A_j(W) T_j(\lambda) a_{ij}	
	=\sum_{j=1}^3 A_j(W) T_j(\lambda) S_i(\lambda_j) 
	=S_i(\lambda)	
	\;\;\;(i=1,2,3)	\]
Solving these equations we get $T_j(\lambda)\;\;\;(j=1,2,3)$ for any
wavelength $\lambda$, i.e., the three spectral matching curves representing 
the amount of each of the spectral red, green and blue needed to match each
spectral color, as shown in the plot. Note that the interpretation of the 
negative values for spectral red at certain wavelengths 
($438.1 nm < \lambda < 546.1 nm$) is the same as discussed before. Namely, 
spectral colors of wavelength in this range should be mixed with the spectral
red to be matched with the mixture of the spectral green and spectral blue.

\htmladdimg{../figures/Color_RGB.gif}

\newpage
\section*{The Color Space}

\subsection*{Representing Color in a 3D Space}

Based on the tristimulus theory, any given color $L(\lambda)$ can be matched
by mixing proper amounts of three primaries:
\[	L(\lambda) \equiv \sum_{j=1}^3 A_j(L) [P_j(\lambda)]	\]

Because the intensities of incoherent lights add linearly, i.e., mixing colors 
$L_1=\sum_j A_j(L_1) P_j(\lambda) $ and $L_2=\sum_j A_j(L_2) P_j(\lambda) $
results a new color which is the linear combination (weighted sum) of the two
colors
\[	L_1+L_2=\sum_{j=1}^3 [A_j(L_1)+A_j(L_2)] P_j(\lambda)		\]
we can use a three dimensional color space spanned by a set of three primary 
colors to represent all colors. In this space, each point (or a vector) is a
color. And a color $L$ produced by mixing two other colors $L_1$ and $L_2$
is represented by the vector sum of the vectors for $L_1$ and $L_2$. 

Any three linearly independent colors can be considered as the primaries
$P_j(\lambda),\;\;(j=1,2,3)$ and used as the three bases of the 3D color 
space. Here linearly independent means none of the three primaries can be
written as the linear combination of the other two, i.e.,
\[	a_1 P_1(\lambda)+a_2 P_2(\lambda)+a_3 P_3(\lambda) \neq 0	\]
unless $a_1=a_2=a_3=0$.

Any given color $L$ in the color space can be specified by its coordinates 
$\{A_1(L),\;A_2(L),\;A_3(L)\}$, just like a point in a 3D Cartesian coordinate
system can be represented by it coordinates $\{ x, y, z\}$ with the following
differences
\begin{itemize}
\item The color space is a space of functions of $\lambda$, instead of 
	a Cartesian space of geometric points or vectors;
\item Orthogonal axes are used in Cartesian coordinate system, 
	while axes used in the color space are usually not orthogonal;
\item As a result of the above, different orthogonal axes are related by
	{\em orthogonal transformations} in Cartesian coordinate system 
	while the axes in the color space are related by {\em projective 
	transformation}.
\end{itemize}

{\bf Question:}

As we know an arbitrary light $L(\lambda)$ is just a function of wavelength
$\lambda$. By claiming that all lights can be represented in a 3D color space 
spanned by a set of three primaries, are we also claiming that all possible 
functions of $\lambda$ can be represented as a linear combination of three 
primaries (linearly independent) functions $P_i(\lambda)\;\;(i=1,2,3)$, an 
obvious wrong mathematical statement? 

Fourier expansion...

{\bf Answer:}

Given the sensitivity functions $S_i(\lambda)$ of the three photoreceptors
of a particular visual system, all possible lights as functions of wavelength 
$L(\lambda)$ are mapped to a 3D color space. Each point in this space 
represents a set of infinite number of all possible lights, the ``matching
colors'', in the sense that they are responded to by the three types of 
photoreceptors in the visual system in exactly the same way. In other words, 
each point in the color space is a family of metamers. Now we see one of the 
reasons why the words {\em light} and {\em color} should be distinguished.

\newpage	
\subsection*{LMS Coordinate System}

The response intensities of the L, M and S cones can be used as the bases 
of the 3D color space. Any {\em perceived} color is represented by a ray or 
a vector initiated from the origin along a certain direction determined by the 
proportions between the LMS responses. Note that every point in this 3D space
represents a unique perceived color, but not a unique physical color of unique
energy spectral distributions. In other words, a point in the color space 
represents all energy spectral distributions that are perceived the same.

All spectral (monochromatic) color of single wavelength ranging from 350 nm to
780 nm form a curved surface like a bent fan starting from the long wavelength
at 780 nm very close to the L axis and ending at short wavelength at 350 very
close to the S axis. This surface is everywhere convex. If this surface is 
truncated by a specific intensity the resulting edge is the {\em spectrum 
locus}. The line connecting the two end points (for red and violet) is called 
the {\em purple line}.

Since any color as a function of the wavelength $\lambda$ is a linear 
combination of all the spectral colors,
\[	L(\lambda)=\int c(\lambda') \delta(\lambda-\lambda') d\lambda' \]
it is represented in the color space as a vector sum of the vectors along 
the spectral surface. We conclude that all perceivable colors are inside the
conical solid enclosed by the spectral surface and the plane formed by the 
purple line and the origin. The cross section of this solid and the plane 
representing some certain intensity is called the {\em chromaticity diagram}
representing all visible colors of the particular intensity. Usually this
cross section in 3D color space is projected onto a 2D subspace spanned by two
basis functions defined in some specific way (e.g., red and green).

\htmladdimg{../figures/Color_LMS_0.gif}
   
\htmladdimg{../figures/Color_LMS.gif}

Note that energy distribution of light can be described by either wavelength
$\lembda$ or frequency $f$ which are related by:
\[	\lambda=c/f	\]
where $c=3 \times 10^8 m/sec.$ is the speed of light. For example, 
wavelength $\lambda=500 nm$ is equivalent to 
\[ f=c/\lambda = 3 \times 10^8/500 \times 10^{-9}=600 \times 10^{-12} \] hertz 
or $600$ Tera Hertz or THz.



\subsection*{CIE's Spectral RGB Coordinate System}

The CIE spectral RGB discussed before can also be used as the bases of the
color space. Each color is a point in the space with the coordinates 
representing the amounts of the RGB primaries needed to match the color.
We see some colors have negative Red coordinates as they need to be matched 
with negative Red primary. Specifically, the spectral colors in the range of
$438.1 nm < \lambda < 546.1 nm$ are on the negative side of red axis, as
indicated by the intersections of the spectrum locus with the vertical (green)
axis. In other words, only the colors in the positive octant can be physically
produced by mixing these three primaries.

\htmladdimg{../figures/Color_LMS_RGB.gif}

\subsection*{CIE's XYZ Coordinate System}

CIE developed a set of three {\em hypothetical} (unreal, imaginary) primaries
{\bf X}, {\bf Y}, and {\bf Z} in order to be able to match {\em any} color $L$
by mixing these primaries with {\em positive} weights $X(L)$, $Y(L)$ and $Z(L)$. 
This means that in the color space the three axes of X, Y and Z must lie outside
the conical solid first discussed in the LMS coordinate system. (Or, equivalently
the conical solid must lie entirely inside the positive octant of the XYZ coordinate
system.) The XYZ primaries are not real because they cannot be physically realized. 
Otherwise some ``colors'' outside the conical solid might be produced by mixing the
XYZ primaries with certain (positive) weights, a result directly contradicting the 
fact that {\em all} colors we can possibly see are inside the conical solid. 

The tristimulus spectral matching curves for these XYZ primaries are shown in the
figure, and indeed they are always positive for the entire range of visible 
wavelengths (and therefore all linear combinations thereof).

The {\em chromaticity} values of a color is defined by its weights for the three 
primaries normalized by the total energy $X+Y+Z$:
\[ x=\frac{X}{X+Y+Z},\;\;y=\frac{Y}{X+Y+Z},\;\;z=\frac{Z}{X+Y+Z} \]
so that 
\[	x+y+z=1		\]
Chromaticity values depend on the hue and saturation of the color, but are 
independent of the intensity. (Hue, saturation and intensity are three independent
variables describing a color, as to be discussed later.)

All visible colors are represented by the points inside an enclosed area in the
$X+Y+Z=1$ plane. And the chromaticity diagram is the projection of this enclosed 
area on $(X,Y)$ plane.

\htmladdimg{../figures/Color_XYZ.gif}

\htmladdimg{../figures/Color_XYZ_solid.gif}

\htmladdimg{../figures/Color_LMS_XYZ.gif}

\htmladdimg{../figures/Color_diagram.gif}

\htmladdimg{../figures/CIE_chromaticity.gif}


\subsection*{RGB Primaries of Color Monitors}

The colors on TV and computer screens are produced by three types of phosphors
coated on the inner surface of the screen each activated by an electronic beam. 
When activated by the electronic beam, the phosphors emit respectively red, 
green, and blue light with certain spectral distributions and with intensity 
proportional to the current. By mixing these three colors as the primaries 
with different proportions, many other colors can be produced. These three 
primaries can be used as the basis functions in the color space as shown. 
As these primaries are real and actually implemented, the positive parts of
their corresponding axes must lie entirely inside the conical solid representing
all visible colors. In other words, the colors producible by the phosphors are
only a subset of all visible colors. In the figure, the NTSC (National 
Television Systems Committee) receiver primaries are shown.

\htmladdimg{../figures/Color_NTSC.gif}

Any color inside the shaded triangle area can be generated by mixing the R, G, and
B primaries at proper proportion. But as can be seen, certain perceivable colors
outside the triangle cannot be generated by mixing the primaries.

\htmladdimg{../figures/Color_RGB_primaries.gif}

This diagram shows some mixtures of the three primaries:
\begin{itemize}
\item Red + Green = Yellow
\item Green + Blue = Cyan
\item Blue + Red = Magenta
\item Red + Green + Blue = White
\end{itemize}

{\bf Question:}

Is it possible to construct a set of three {\bf realizable} primaries which 
can be used to match all perceivable colors with positive tristimulus values
(weights)?

{\bf Answer:}

Any set of three primaries is always represented by some three straight lines 
in the 3D color space, and all colors matchable by these primaries are inside 
the subspace spanned by the positive part of the three straight lines. But, on
the other hand, all perceivable colors are inside the conical solid with curved
surface (the spectrum locus and the purple line) which cannot be fit precisely
by any three straight lines. As the result, we can either try to find a set of
primaries with the positive part of the corresponding straight lines completely
inside the conical solid, but still covering as much space as possible (such 
as the RGB primaries used for color screens) to make sure positive weights; or
use a set of {\em unrealizable} primaries which can lie outside the conical
solid so that the solid can be enclosed completely in the space spanned by the
positive part of the corresponding straight lines, such as the CIE XYZ
primaries. In other words, it is {\em impossible} to match all perceivable
colors by a set of realizable primaries.

\newpage
\subsection*{Transformation between Different Color Systems}

As we have seen, any three linearly independent colors can be considered as
the primary colors and used as the bases of the 3D color space. Therefore the
same color may be represented by different tristimulus values under different
color systems of different primaries. For example, consider color $L(\lambda)$
matched in the color space by two sets of primaries $P_j(\lambda)\;\;(j=1,2,3)$
and $Q_j(\lambda)\;\;(j=1,2,3)$:
\[	L(\lambda) \equiv \sum_{j=1}^3 A_j P_j(\lambda)
		   \equiv \sum_{j=1}^3 B_j Q_j(\lambda)	\]
As all terms in this equation are matching colors, they must all cause the same
receptor responses:
\[	r_i=\int L(\lambda) S_i(\lambda) d\lambda
	=\sum_{j=1}^3 A_j \int P_j(\lambda) S_i(\lambda) d\lambda
	=\sum_{j=1}^3 B_j \int Q_j(\lambda) S_i(\lambda) d\lambda
	\;\;\;(i=1,2,3)
\]
To find the relationship between the two sets of tristimulus values 
$[A_1, A_2, A_3]$ and $[B_1, B_2, B_3]$, we first consider matching the second
set of primaries by the first set:
\[	Q_k(\lambda) \equiv Q'_k(\lambda)
	=\sum_{j=1}^3 C_{kj} P_j(\lambda)\;\;\;(k=1,2,3) \]
Note that in general $Q'_k(\lambda)$ and $Q_k(\lambda)$ do not have identical
spectral energy distributions, but they are matching colors represented by the
same point in the 3D color space. Now we can use $Q'_k(\lambda)$'s as the 
primaries to match the color $L(\lambda)$ so that
\begin{eqnarray}
r_i	& = &	\sum_{k=1}^3 B_k \int Q'_k(\lambda) S_i(\lambda) d\lambda
	 = 	\sum_{k=1}^3 B_k \int \sum_{j=1}^3 C_{kj} P_j(\lambda)
	 S_i(\lambda) d\lambda
		\nonumber \\
	& = &	\sum_{k=1}^3 B_k \sum_{j=1}^3 C_{kj} \int P_j(\lambda)
	 S_i(\lambda) d\lambda
	 = 	\sum_{j=1}^3 A_j \int P_j(\lambda) S_i(\lambda) d\lambda
	\;\;\;(i=1,2,3)	  \nonumber
\end{eqnarray}
The last equation is due to the fact that this color is also matched by
the primary $P_j(\lambda)$'s as assumed originally, and can be written as
\[	\sum_{j=1}^3 [ A_j-\sum_{k=1}^3 C_{kj} B_k ]
	\int P_j(\lambda) S_i(\lambda) d\lambda =0 \;\;\;(i=1,2,3)	\]
As in general
\[	\int P_j(\lambda) S_i(\lambda) d\lambda \neq 0	\]
we must have
\[	A_j=\sum_{k=1}^3 C_{kj} B_k \;\;\;(j=1,2,3)	\]
Now the relationship between the two sets of primaries can be summarized as
\begin{itemize}
\item For the primaries:
\[	Q'_k=\sum_{j=1}^3 C_{kj} P_j\;\;\;(k=1,2,3)	\]
\item For the tristimulus values:
\[	A_j=\sum_{k=1}^3 C_{kj} B_k\;\;\;(j=1,2,3)	\]
\end{itemize}
To express the above relationship in matrix form, define $\mbox{\bf P}(\lambda)$, 
$\mbox{\bf Q}(\lambda)$, $\mbox{\bf A}$ and $\mbox{\bf B}$:
as 3D vectors
\[	\mbox{{\bf P}(\lambda)}\stackrel{\triangle}{=}
	[P_1(\lambda), P_2(\lambda), P_3(\lambda)]^T	\]
\[	\mbox{{\bf Q}}(\lambda)\stackrel{\triangle}{=}
	[Q_1(\lambda), Q_2(\lambda), Q_3(\lambda)]^T	\]
\[	\mbox{{\bf A}}\stackrel{\triangle}{=}[A_1, A_2, A_3]^T	\]
\[	\mbox{{\bf B}}\stackrel{\triangle}{=}[B_1, B_2, B_3]^T	\]
and $C$ as a 3 by 3 matrix
\[	\mbox{{\bf C}}\stackrel{\triangle}{=}\left[ \begin{array}{lll}
		C_{11} & C_{12} & C_{13} \\
		C_{21} & C_{22} & C_{23} \\
		C_{31} & C_{32} & C_{33} \end{array} \right] 	\]
and we have
\[	\mbox{{\bf Q'}}(\lambda)=\mbox{{\bf C}}   \mbox{{\bf P}}(\lambda)	\]
and 
\[	\mbox{{\bf A}}=\mbox{{\bf C}}^T \mbox{{\bf B}}	\]
where $\mbox{{\bf C}}^T$ represents the transpose of matrix $\mbox{{\bf C}}$.
These linear relations are called {\em projective transforms}.


\section*{Three Components of Color}

As we now know all perceived colors can be represented by three independent
variables, either the LMS responses, or the tristimulus values under the
primaries of a given color system, such as RGB or XYZ. In many situations 
(e.g., computer image processing), it is more convenient to represent a color
by a different set of three independent variables HSL (or HSI, HSV). These are
defined as
\begin{itemize}
	\item {\em Hue:} the dominant wavelength, the redness of red, greenness
		 of green, etc.
	\item {\em Saturation:} the purity of the color, or how much white is
		contained in the color. For example, red and royal blue
		are more saturated than pink and sky blue, respectively.
	\item {\em Luminance (intensity, value):} the intensity of the light.

		Brightness: for measuring self-luminous objects that emits
				light (CRT, etc.)

		Lightness: for measuring reflected light.

\end{itemize}

The hue, saturation and luminance can be obtained given the tristimulus values
of a color under any color system. 

\subsection*{The RGB Cube and Cone Models}

The red, green and blue are used as the three primary colors which span a 3D
space. The intensities of these primaries are calibrated to range from 0 to 1
so that all possible colors that can be produced by these primaries are located
inside the cube as shown:

\htmladdimg{../figures/Color_cube_model.gif}

The origin of the coordinate system is black where $R=G=B=0$, while the point
$R=G=B=1$ represents white. The line segment formed by the black and white 
points is the line of grays representing different gray levels. A cross section
plane perpendicular to the line of grays and going through point $R=G=B=0.5$
is shown in the figure 

\htmladdimg{../figures/Color_cube_model0.gif}

As can be seen this cross section has the shape of a hexagon with highly
saturated hues along its sides (e.g., red, yellow, green, cyan, blue, and magenta
in the middle part of the six sides, respectively), Also we see that the closer
a color is to the line of grays, the less saturated it becomes. The third variable
intensity is not represented in this cross section.

The hue, saturation and intensity of colors can also be represented by a similar
model as shown below:

\htmladdimg{../figures/Color_cone_model.gif}

A horizontal cross section going through the middle of the cone is shown here:

\htmladdimg{../figures/Color_cone_model1.gif}

Two perpendicular vertical cross sections cutting through center of the cone 
are also shown:

\htmladdimg{../figures/Color_cone_model2.gif}
\htmladdimg{../figures/Color_cone_model3.gif}


\end{document}

