
\documentclass[11pt,a4paper]{article}
\usepackage[english]{babel}
%\usepackage{minitoc}
\usepackage{float}
%\usepackage{placeins}
%\usepackage{varioref}
\usepackage[latin1]{inputenc}
%\usepackage[T1]{fontenc}
\usepackage{babel}
%\usepackage{subfigure}
%\usepackage{geometry}
\usepackage{amsmath}
\usepackage{graphics}
\usepackage[dvips]{graphicx}
%\usepackage{setspace}
%\usepackage{rotating}
\usepackage{amssymb}
\usepackage{epsfig}
%\usepackage{algorithmic}
%\usepackage{algorithm}
%\usepackage{pstricks}

\title{The Retinal-Image software}

\begin{document}
%%\maketitle

\Large{This document quickly gives the main steps preformed by the retinal image software}

\section{Load the Judd51 $\overline{x}$, $\overline{y}$ and $\overline{z}$}

\begin{figure}[H]
\begin{center}
\includegraphics[width=0.85\columnwidth]{Images/xyzBar.ps}
    \caption{Judd551 $\overline{x}$, $\overline{y}$, $\overline{z}$}
    \label{fig:xyzBar}
\end{center}
\end{figure}


\section{Load the CRT's Spectral Power Distribution}

\begin{figure}[H]
\begin{center}
\includegraphics[width=0.85\columnwidth]{Images/SPD.ps}
    \caption{CRT's Spectral Power Distribution}
    \label{fig:SPD}
\end{center}
\end{figure}

\section{Compute (or load) the Smith-Pokorny fundamentals}

\begin{figure}[H]
\begin{center}
\includegraphics[width=0.85\columnwidth]{Images/SmithPokorny.ps}
    \caption{Smith-Pokorny fundamentals}
    \label{fig:SmithPokornyFund}
\end{center}
\end{figure}


%\begin{table} [H]
%\begin{center}
%\begin{tabular}{ c c c c c c c}
%L &  & 0.15514 & 0.54312 & -0.03286 &  & xbar\\
%M & = & -0.15514 & 0.45684 & 0.03286 & $\times$ & ybar\\
%S &  & 0.0 & 0.0 & 1.0204 & & zbar\\
%\end{tabular}\\
%\caption{Judd51 xyzbar2LMS conversion}
%\label{tab:Judd51xyzBar2LMS}
%\end{center}
%\end{table}

\begin{table} [H]
\begin{center}
\(\left[
\begin{tabular}{ c}
L \\
M\\
S \\
\end{tabular}
\right]\)
=
\(\left[
\begin{tabular}{ c c c }
0.15514 & 0.54312 & -0.03286\\
-0.15514 & 0.45684 & 0.03286\\
0.0 & 0.0 & 1.0204\\
\end{tabular}
\right]
\times
\left[
\begin{tabular}{ c}
$\overline{x}$\\
$\overline{y}$\\
$\overline{z}$\\
\end{tabular}
\right]
\)
\caption{Judd51 xyzbar2LMS conversion}
\label{tab:Judd51xyzBar2LMS}
\end{center}
\end{table}

%\[\left[  \begin{array}{c}
%L \\
%M \\
%S \end{array}\right]
%= \left[ \begin{array}{ccc}
%0.15514 & 0.54312 & -0.03286  \\
%-0.15514 & 0.45684 & 0.03286\\
%0.0 & 0.0 & 1.0204 
%\end{array}\right] 
%\times
%\left[
%\begin{array}{c}
%xbar \\
%ybar \\
%zbar \end{array} \right]
%\] 
%\begin{center}
%\textbf{Judd51 xyzbar2LMS conversion}
%\end{center}

%\[\left[  \begin{array}{c}
%L \\
%M \\
%S \end{array}\right]
%= \left[ \begin{array}{ccc}
%0.15514 & 0.54312 & -0.03286  \\
%-0.15514 & 0.45684 & 0.03286\\
%0.0 & 0.0 & 0.01608 
%\end{array}\right] 
%\times
%\left[
%\begin{array}{c}
%xbar \\
%ybar \\
%zbar \end{array} \right]
%\] 
%\begin{center}
%\textbf{Judd-Vos78 xyzbar2LMS conversion}
%\end{center}

\begin{table} [H]
\begin{center}
\(\left[
\begin{tabular}{ c}
L \\
M\\
S \\
\end{tabular}
\right]\)
=
\(\left[
\begin{tabular}{ c c c }
0.15514 & 0.54312 & -0.03286\\
-0.15514 & 0.45684 & 0.03286\\
0.0 & 0.0 & 0.01608\\
\end{tabular}
\right]
\times
\left[
\begin{tabular}{ c}
$\overline{x}$\\
$\overline{y}$\\
$\overline{z}$\\
\end{tabular}
\right]
\)
\caption{Judd-Vos78 xyzbar2LMS conversion}
\label{tab:Judd78xyzBar2LMS}
\end{center}
\end{table}



%\begin{table} [H]
%\begin{center}
%\begin{tabular}{ c c c c c c c}
%L &  & 0.15514 & 0.54312 & -0.03286 &  & xbar\\
%M & = & -0.15514 & 0.45684 & 0.03286 & $\times $ & ybar\\
%S &  & 0.0 & 0.0 & 0.01608 & & zbar\\
%\end{tabular}\\
%\caption{Judd-Vos78 xyzbar2LMS conversion}
%\label{tab:Judd78xyzBar2LMS}
%\end{center}
%\end{table}

\section{Compute the PSFs for each wavelength}

\begin{equation}
PF \left( \lambda \right) = AT \times \exp \left( \frac{i2 \pi W}{\lambda} \right)
\end{equation}

\begin{equation}
ASF \left( \lambda \right) = ifft\left( PF \left( \lambda \right)\right)
\end{equation}

\begin{equation}
OTF \left( \lambda \right) = fft\left( PSF \left( \lambda \right)\right)
\end{equation}

\begin{equation}
RI \left( \lambda \right) = I\left( \lambda \right) \otimes PSF\left( \lambda \right)
\end{equation}

\begin{equation}
PSF \left( \lambda \right) = Mod \left( ASF \left( \lambda \right)  \right) = ASF \left( \lambda \right) \times conj \left( ASF \left( \lambda \right)  \right)
\end{equation}

\begin{equation}
PTF\left( \lambda \right) = Phase \left( OTF \left( \lambda \right)  \right)
\end{equation}

\begin{equation}
MTF\left( \lambda \right) = Modulus \left( OTF \left( \lambda \right)  \right)
\end{equation}

\begin{table} [H]
%\begin{center}
\begin{tabular}{ c c }
PF & Pupil function\\
AT & Amplitude Transmittance (Stiles Crawford effect)\\
W & Wave aberration = f(Pupil diameter)\\
ASF & Amplitude Spread Function\\
OTF & Optical Transfer Function\\
RI & Retinal Image\\
I & Displayed image (CRT)\\
\end{tabular}\\
%\caption{PSFs}
\label{tab:acronyms}
%\end{center}
\end{table}


\begin{table} [H]
%\begin{center}
\begin{tabular}{ c c }
\textbf{Default Parameters :} &  \\
Pupil Diameter & 3 mm,\\
Focus Wavelength & 570 nm,\\
Zernike order & 15,\\
Pupil shift X, Pupil Shift Y & 0mm,\\
Wavelengths & 400:10:750,\\
Displayed image size & 512 pixels,\\ 
Pupil function size & 256.\\
\end{tabular}\\
%\caption{PSFs}
\label{tab:params}
%\end{center}
\end{table}


Images given for wavelegths: 400, 450, 500, 550, 600, 650, 700, 750.

Full images, Zoom-in (110 $\times$ 110 pixels), Surface plot (110 $\times$ 110).



\begin{table} [H]
\begin{center}
\begin{tabular}{ c c c c }
\includegraphics[width=0.33\columnwidth]{Images/Bpsf400.ps} & \includegraphics[width=0.18\columnwidth]{Images/Zpsf400.ps} & \includegraphics[width=0.33\columnwidth]{Images/Spsf400.ps} & 400nm \\
\includegraphics[width=0.33\columnwidth]{Images/Bpsf450.ps} & \includegraphics[width=0.18\columnwidth]{Images/Zpsf450.ps} & \includegraphics[width=0.33\columnwidth]{Images/Spsf450.ps} & 450nm \\
\includegraphics[width=0.33\columnwidth]{Images/Bpsf500.ps} & \includegraphics[width=0.18\columnwidth]{Images/Zpsf500.ps} & \includegraphics[width=0.33\columnwidth]{Images/Spsf500.ps} & 500nm \\
\includegraphics[width=0.33\columnwidth]{Images/Bpsf550.ps} & \includegraphics[width=0.18\columnwidth]{Images/Zpsf550.ps} & \includegraphics[width=0.33\columnwidth]{Images/Spsf550.ps} & 550nm \\
\end{tabular}\\
\caption{PSFs}
\label{tab:PSFs1}
\end{center}
\end{table}

\begin{table} [H]
\begin{center}
\begin{tabular}{ c c c c }
\includegraphics[width=0.33\columnwidth]{Images/Bpsf600.ps} & \includegraphics[width=0.18\columnwidth]{Images/Zpsf600.ps} & \includegraphics[width=0.33\columnwidth]{Images/Spsf600.ps} & 600nm \\
\includegraphics[width=0.33\columnwidth]{Images/Bpsf650.ps} & \includegraphics[width=0.18\columnwidth]{Images/Zpsf650.ps} & \includegraphics[width=0.33\columnwidth]{Images/Spsf650.ps} & 650nm \\
\includegraphics[width=0.33\columnwidth]{Images/Bpsf700.ps} & \includegraphics[width=0.18\columnwidth]{Images/Zpsf700.ps} & \includegraphics[width=0.33\columnwidth]{Images/Spsf700.ps} & 700nm \\
\includegraphics[width=0.33\columnwidth]{Images/Bpsf750.ps} & \includegraphics[width=0.18\columnwidth]{Images/Zpsf750.ps} & \includegraphics[width=0.33\columnwidth]{Images/Spsf750.ps} & 750nm \\
\end{tabular}\\
\caption{PSFs}
\label{tab:PSFs2}
\end{center}
\end{table}

\section{Read the input images (lsY2LMS2RGB )}

\begin{table} [H]
\begin{center}
\begin{tabular}{ c c c }
R & G & B \\
\includegraphics[width=0.28\columnwidth]{Images/PercR.ps} & \includegraphics[width=0.28\columnwidth]{Images/PercG.ps} & \includegraphics[width=0.28\columnwidth]{Images/PercB.ps} \\
\end{tabular}
\caption{Input images}
\label{tab: Percentage}
\end{center}
\end{table}

\textit{Background : }

lsY = (0.72, 0.5, 10.0)

LMS =(7.2, 2.8, 5.0)

RGB = (17, 4, 2)


\textit{Grid : }

lsY = (0.6, 3.0, 12.0)

LMS =(7.2, 4.8, 36.0)

RGB = (2, 7, 23)


\section{Decompose the input image into wavelengths (for each (x,y) pixel)}

%\begin{equation}
%Image[\lambda, x, y] = Im_{R}[x,y] \times W_{R} \times SPD_{R} +\\
%Im_{G}[x,y] \times W_{G} \times SPD_{G} +\\
%Im_{B}[x,y] \times W_{B} \times SPD_{B}
%\end{equation}

\begin{equation}
\begin{array}{cc}
Image[\lambda, x, y] = 
 & Im_{R}[x,y] \times W_{R} \times SPD_{R}  +  \\
 & Im_{G}[x,y] \times W_{G} \times SPD_{G}  + \\
 & Im_{B}[x,y] \times W_{B} \times SPD_{B}
\end{array}
\label{eq:WavTransform}
\end{equation}

where \(Im_{R}\), \(Im_{G}\) and \(Im_{B}\) represents the percentage of the R, G, B guns for each pixel, \(W_{R}\), \(W_{G}\),
\(W_{B}\) are weighting parameters :

\begin{equation}
W_{R} = \frac{Y_{R}}{\sum_{\lambda}\left( V\left( \lambda \right) \times SPD_{R}\right) }
\end{equation}

\begin{equation}
W_{G} = \frac{Y_{G}}{\sum_{\lambda}\left( V\left( \lambda \right) \times SPD_{G}\right) }
\end{equation}

\begin{equation}
W_{B} = \frac{Y_{B}}{\sum_{\lambda}\left( V\left( \lambda \right) \times SPD_{B}\right) }
\end{equation}

and \(SPD_{R}\), \(SPD_{G}\) and \(SPD_{B}\) are the spectral power distribution of the Red, Green and Blue guns.

\begin{table} [H]
\begin{center}
\begin{tabular}{ c c c c }
400 nm & 450 nm & 500 nm &  550 nm\\
\includegraphics[width=0.2\columnwidth]{Images/Wav400.ps} & \includegraphics[width=0.2\columnwidth]{Images/Wav450.ps} & \includegraphics[width=0.2\columnwidth]{Images/Wav500.ps} & \includegraphics[width=0.2\columnwidth]{Images/Wav550.ps} \\
600 nm & 650 nm & 700 nm &  750 nm\\
\includegraphics[width=0.2\columnwidth]{Images/Wav600.ps} & \includegraphics[width=0.2\columnwidth]{Images/Wav650.ps} & \includegraphics[width=0.2\columnwidth]{Images/Wav700.ps} & \includegraphics[width=0.2\columnwidth]{Images/Wav750.ps} \\
\end{tabular}
\caption{Wavelengths images}
\label{tab: WavImges}
\end{center}
\end{table}


\section{Convolve each PSF with each wavelength image}

This gives the retinal images for each wavelength.

\textbf{\textit{Convolution theorem:}}

\begin{equation}
WI\left( \lambda \right) \otimes PSF\left( \lambda \right) = ifft\left\{ fft\left[WI\left(\lambda \right)\right] \times fft\left[PSF\left(\lambda \right)\right]\right\}
\end{equation}

where \(WI\left( \lambda \right)\) is the wavelength representation of the displayed image


\begin{table} [H]
\begin{center}
\begin{tabular}{ c c c c }
400 nm & 450 nm & 500 nm &  550 nm\\
\includegraphics[width=0.22\columnwidth]{Images/RI400.ps} & \includegraphics[width=0.22\columnwidth]{Images/RI450.ps} & \includegraphics[width=0.22\columnwidth]{Images/RI500.ps} & \includegraphics[width=0.22\columnwidth]{Images/RI550.ps} \\
600 nm & 650 nm & 700 nm &  750 nm\\
\includegraphics[width=0.22\columnwidth]{Images/RI600.ps} & \includegraphics[width=0.22\columnwidth]{Images/RI650.ps} & \includegraphics[width=0.22\columnwidth]{Images/RI700.ps} & \includegraphics[width=0.22\columnwidth]{Images/RI750.ps} \\
\end{tabular}
\caption{Retinal images}
\label{tab: RetImges}
\end{center}
\end{table}


\section{Compute the LMS cones absorption}

For each type of cones (L,M,S)

For each (x,y) pixel position

For each wavelength


\begin{equation}
cones  abs\left(x,y\right) = \sum_{\lambda = 400}^{850} \left( RI\left(\lambda, x, y\right) \times SPF\left(cones, \lambda\right)\right)
\end{equation}

\(RI\left(\lambda, x, y\right) \) : Wavelength Retinal image, 


\(SPF\left(cones, \lambda \right)\) : Smith-Pokorny fundamentals


\begin{table} [H]
\begin{center}
\begin{tabular}{ c c c }
L image & M image & S image \\
\includegraphics[width=0.28\columnwidth]{Images/Lim.ps} & \includegraphics[width=0.28\columnwidth]{Images/Mim.ps} & \includegraphics[width=0.28\columnwidth]{Images/Sim.ps} \\
\end{tabular}
\caption{LMS images}
\label{tab: LMS}
\end{center}
\end{table}

\section{Compute l and s}

\(l=\frac{L}{L+M}, s=\frac{S}{L+M}, m=1-l\)

Compute the average value on several windows sizes (2x2, 4x4, 6x6, 8x8, 10x10, 12x12 pixels) (The windows are centered
in the middle of a square).


Different pupil size (2.5, 3.0, 3.5, 4.0 mm) and different Focus wavelengths (500, 525, 550, 575 nm) have been tested.
2 inducing chrfomaticities, 4 induced chromaticities.


Plots below shows results for a lsY=(0.6, 3.0, 12.0) inducing chromaticity and for a (0.7, 0.5, 10.0) induced
chromaticity.



\begin{table} [H]
\begin{center}
\begin{tabular}{ c c }
Pup diameter=25mm & Pup diameter=30mm\\
\includegraphics[width=0.45\columnwidth]{Images/ResPup25.ps} & \includegraphics[width=0.45\columnwidth]{Images/ResPup30.ps}\\
Pup diameter=35mm & Pup diameter=40mm\\
\includegraphics[width=0.45\columnwidth]{Images/ResPup35.ps} & \includegraphics[width=0.45\columnwidth]{Images/ResPup40.ps}\\
\end{tabular}
\caption{Results}
\label{tab: ResPup}
\end{center}
\end{table}

 
\section{Apply a center-surround receptive field}

Not tested yet, but the program allows to create and tuine a +s/-s center surround Receptive field (Difference of
Gaussian), and to convolve it with the LMS cones maps.


\end{document}

