Nick LaVassar: Difference between revisions

From Psych 221 Image Systems Engineering
Jump to navigation Jump to search
imported>Lavassar
Created page with '= Background = You can use subsections if you like. Below is an example of a retinotopic map. Or, to be precise, below ''will'' be an example of a retinotopic map once the ima…'
 
imported>Lavassar
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Introduction =
Color vision deficiency (often called "colorblindness") affects hundreds of millions of people around the world.  The deficiency is sex linked: approximately 8% of men have a CVD versus only  0.5% of females.  This project aims to simulate the most common types of CVDs for people with normal color perception.  The simulation will be run in realtime on an iOS device.
= Background =
= Background =


You can use subsections if you like.
Color vision deficiencies are characterized by reduced sensitivity to color as a result of anomalies in the eye's color receptors (called cones)In extremely rare cases, the cones in the eye are either completely absent or totally dysfunctional which results in monochromacy (no color perception).  When only one cone is missing a person is said to be dichromatic.  The most common CVDs are caused by a shift in the sensitivity of one of the types of cone in the eye and is known as anomalous trichromacy.
Below is an example of a retinotopic mapOr, to be precise, below ''will'' be an example of a retinotopic map once the image is uploaded. To add an image, simply put text like this inside double brackets 'MyFile.jpg | My figure caption'. When you save this text and click on the link, the wiki will ask you for the figure.
<br>
[[File:Example.jpg | Figure 1]]


Below is another example of a reinotopic map in a different subject.
CVDs are classified according to which cone type is affected:
<br>
[[File:Example2.jpg | Figure 2]]


Once you upload the images, they look like this. Note that you can control many features of the images, like whether to show a thumbnail, and the display resolution.
* Protanomaly - L cone sensitivity is defective.
[[File:Example3.jpg |thumb|300px|center| Figure 3]]
* Deuteranomaly - M cone sensitivity is defective.
<br>
* Tritanomaly - S cone sensitivity is defective.


== MNI space ==
Likewise, someone with dichromatic vision is completely missing either their L, M or S cones, and is called either a protanope, deuteranope, or tritanope, respectively.
 
Protanopia and deuteranopia reduce senstivity to red-green colors, while tritanopia reduces sensitivity to blue-yellow colors.


MNI is an abbreviation for [http://en.wikipedia.org/wiki/Montreal_Neurological_Institute Montreal Neurological Institute].


= Methods =
= Methods =
== Measuring retinotopic maps ==
Retinotopic maps were obtained in 5 subjects using Population Receptive Field mapping methods [http://white.stanford.edu/~brian/papers/mri/2007-Dumoulin-NI.pdf Dumoulin and Wandell (2008)]. These data were collected for another [http://www.journalofvision.org/9/8/768/ research project] in the Wandell lab. We re-analyzed the data for this project, as described below. 


=== Subjects ===
== Overview ==
Subjects were 5 healthy volunteers.


=== MR acquisition ===
Simulation steps are as follows:
Data were obtained on a GE scanner. Et cetera.


=== MR Analysis ===
* Precompute matrices mapping from RGB to opponent color space for range of CVD types and severities.
The MR data was analyzed using [http://white.stanford.edu/newlm/index.php/MrVista mrVista] software tools.  
* Linearize RGB values from input camera in preparation for calculations in LMS space.
* Multiply linear RGB value with opponent CVD matrix to get opponent color space representation of what a color deficient person receives as input to their neural pathways.
* Multiply deficient opponent colorspace representation by the inverse opponent matrix conversion of a normal color perceiver to get trichromat representation.
* Reapply gamma and display on screen.


==== Pre-processing ====
== Computations ==
All data were slice-time corrected, motion corrected, and repeated scans were averaged together to create a single average scan for each subject. Et cetera.


==== PRF model fits ====
Anomalous trichromacy can be simulated by shifting the sensitivity of the L, M, and S cones in the following ways^[[#cvd |1]]:
PRF models were fit with a 2-gaussian model.


==== MNI space ====
* Protanomaly - Shift L cone toward M cone <math>L(\lambda)_a = L(\lambda +\Delta \lambda_L)</math>
After a pRF model was solved for each subject, the model was trasnformed into MNI template space. This was done by first aligning the high resolution t1-weighted anatomical scan from each subject to an MNI template. Since the pRF model was coregistered to the t1-anatomical scan, the same alignment matrix could then be applied to the pRF model. <br>
* Deuteranomaly - Shift M cone toward L cone <math>M(\lambda)_a = M(\lambda +\Delta \lambda_M)</math>
Once each pRF model was aligned to MNI space, 4 model parameters - x, y, sigma, and r^2 - were averaged across each of the 6 subjects  in each voxel.
* Trianomaly - Shift S cone: <math>S(\lambda)_a = S(\lambda +\Delta \lambda_S)</math>


Et cetera.
We can convert from LMS to opponent color space using the following transform:


: <math>
\begin{bmatrix}
WS(\lambda) \\
YB(\lambda) \\
RG(\lambda)
\end{bmatrix} =
\begin{bmatrix}
0.600 & 0.400 & 0.000 \\
0.240 & 0.105 & 0.700  \\
1.200 & 1.600 & 0.400 \\
\end{bmatrix}
\begin{bmatrix}
L(\lambda) \\
M(\lambda) \\
S(\lambda)
\end{bmatrix}
</math>


= Results - What you found =
Then, by projecting the opponent color representation of LMS onto the spectral values of the primary phosphors, we arrive at a matrix conversion from RGB to opponent color space:


== Retinotopic models in native space ==
: <math>
Some text. Some analysis. Some figures.
\Gamma =  
\begin{bmatrix}
WS_R & WS_G & WS_B \\
BY_R & BY_G & BY_B  \\
RG_R & RG_G & RG_B \\
\end{bmatrix}
</math>


== Retinotopic models in individual subjects transformed into MNI space ==
To obtain a \Gamma representation for given CVD, we simply insert the appropriately morphed cone distribution function and recompute the projection. The following functions are essentially linear interpolations between the L and M cones that also morph the functions to approximately overlap one another at either end of a full shift. Thus, these functions define simulated severities of a deuteranomaly or protanomaly.  
Some text. Some analysis. Some figures.


== Retinotopic models in group-averaged data on the MNI template brain ==
*  <math> L_a(\lambda) = \alpha L(\lambda) + (1-\alpha) * 0.96 * {Area_L} / {Area_M} * M(\lambda) </math>
Some text. Some analysis. Some figures. Maybe some equations.
*  <math> M_a(\lambda) = \alpha M(\lambda) + (1-\alpha) * 1.042 * {Area_M} / {Area_L} * L(\lambda) </math>


Tritanomaly is modeled by simply linearly shifting the S cone distribution function.


=== Equations===
<math> S_a(\lambda) =  S(\lambda + \Delta\lambda_S) </math>
If you want to use equations, you can use the same formats that are use on wikipedia. <br>  
''See wikimedia help on [http://meta.wikimedia.org/wiki/Help:Displaying_a_formula formulas] for help.'' <br>
This example of equation use is copied and pasted from [http://en.wikipedia.org/wiki/Discrete_Fourier_transform wikipedia's article on the DFT].


The [[sequence]] of ''N'' [[complex number]]s ''x''<sub>0</sub>, ..., ''x''<sub>''N''−1</sub> is transformed into the  sequence of ''N'' complex numbers ''X''<sub>0</sub>, ..., ''X''<sub>''N''−1</sub> by the DFT according to the formula:


:<math>X_k = \sum_{n=0}^{N-1} x_n e^{-\frac{2 \pi i}{N} k n} \quad \quad k = 0, \dots, N-1</math> 
Now, having precomputed \Gamma's for each of the CVDs of interest, we can transform each RGB pixel value into the opponent color representation for the color deficient individual. Then, we can return to a trichromatic representation of that signal in RGB space by multiply by the inverse of the opponent color transformation for someone with normal color perception.
           
where i is the imaginary unit and <math>e^{\frac{2 \pi i}{N}}</math> is a primitive N'th [[root of unity]]. (This expression can also be written in terms of a [[DFT matrix]]; when scaled appropriately it becomes a [[unitary matrix]] and the ''X''<sub>''k''</sub> can thus be viewed as coefficients of ''x'' in an [[orthonormal basis]].)


The transform is sometimes denoted by the symbol <math>\mathcal{F}</math>, as in <math>\mathbf{X} = \mathcal{F} \left \{ \mathbf{x} \right \} </math> or <math>\mathcal{F} \left ( \mathbf{x} \right )</math> or <math>\mathcal{F} \mathbf{x}</math>
: <math>  
\begin{bmatrix}
R_s \\
G_s \\
B_s
\end{bmatrix} =  
\Gamma_{normal}^{-1} \Gamma_{CVD}
\begin{bmatrix}
R \\
G \\
B
\end{bmatrix}
</math>


The '''inverse discrete Fourier transform (IDFT)''' is given by
== Implementation ==


:<math>x_n = \frac{1}{N} \sum_{k=0}^{N-1} X_k e^{\frac{2\pi i}{N} k n} \quad \quad n = 0,\dots,N-1.</math>
The method described was implemented on an iPhone to augment the device's camera feed in real time.  As a result, the simulation is highly portable and easily distributed.


== Retinotopic models in group-averaged data projected back into native space ==
Since the color transformation matrices do not vary per pixel in a processed image, it was possible to apply the operations in parallel on the iPhone's GPU using the OpenGL shading language GLSL.  Without parallelizing the computations on the GPU, interactive framerates would not have been achievable on a device with such limited computation resources.
Some text. Some analysis. Some figures.
 
 
= Results =
 
The following images demonstrate the effect of the three types of dichromacy that can be simulated with the previously discussed algorithm.  Note how deuteropes and protanopes have roughly the same experience (difficulty distinguishing between red and green). 
 
== Normal Color Vision ==
[[File: Nocvd.jpg | Figure 1]]
 
== Deuteranope ==
[[File: Deut.jpg | Figure 2]]
 
== Protanope ==
[[File: Prot.jpg | Figure 3]]
 
== Tritanope ==
[[File: Trit.jpg | Figure 4]]




= Conclusions =
= Conclusions =


Here is where you say what your results mean.
Applying the previously described color vision deficiency simulation to a realtime device yielded a very interesting and hopefully useful tool.  The simulation can be used to entertain and educate people about CVDs.  It can also assist trichromatic designers in creating content for dichromates.
 
When using the tool it is important to remember that it is impossible to say that what you are seeing exactly reproduces the world as it is seen by any given dichromate.  This simulation gives one of an infinite number of actual color representations.  One should focus on the relationships between colors and how they become harder to distinguish not on the actual colors on the screen.
 
= References =


= References - Resources and related work =
<span id="fernandes">[1]</span>[http://www.inf.ufrgs.br/~oliveira/pubs_files/CVD_Simulation/Machado_Oliveira_Fernandes_CVD_Vis2009_final.pdf Gustavo M. Machado, Manuel M. Oliveira, and Leandro A. F. Fernandes "A Physiologically-based Model for Simulation of Color Vision Deficiency". IEEE Transactions on Visualization and Computer Graphics. Volume 15 (2009), Number 6, November/December 2009. pp. 1291-1298.]


References
<span id="brettel">[2]</span>[http://www.opticsinfobase.org/abstract.cfm?URI=josaa-14-10-2647 Hans Brettel, Françoise Viénot, and John D. Mollon, "Computerized simulation of color appearance for dichromats," J. Opt. Soc. Am. A 14, 2647-2655 (1997)]


Software
<span id="vischeck">[3]</span>[http://www.vischeck.com Vischeck]


= Appendix I - Code and Data =
= Appendix I - Code and Data =


==Code==
http://itunes.apple.com/us/app/neweyes/id425311528?mt=8&ls=1
[[File:CodeFile.zip]]


==Data==
(Link may not be active just yet)
[[File:DataFile.zip | zip file with my data]]




[http://white.stanford.edu/teach/index.php/Psych221-Projects-2011#Projects_Wiki_Pages Back to Main Page]
[http://white.stanford.edu/teach/index.php/Psych221-Projects-2011#Projects_Wiki_Pages Back to Main Page]

Latest revision as of 03:56, 21 March 2011

Introduction

Color vision deficiency (often called "colorblindness") affects hundreds of millions of people around the world. The deficiency is sex linked: approximately 8% of men have a CVD versus only 0.5% of females. This project aims to simulate the most common types of CVDs for people with normal color perception. The simulation will be run in realtime on an iOS device.


Background

Color vision deficiencies are characterized by reduced sensitivity to color as a result of anomalies in the eye's color receptors (called cones). In extremely rare cases, the cones in the eye are either completely absent or totally dysfunctional which results in monochromacy (no color perception). When only one cone is missing a person is said to be dichromatic. The most common CVDs are caused by a shift in the sensitivity of one of the types of cone in the eye and is known as anomalous trichromacy.

CVDs are classified according to which cone type is affected:

  • Protanomaly - L cone sensitivity is defective.
  • Deuteranomaly - M cone sensitivity is defective.
  • Tritanomaly - S cone sensitivity is defective.

Likewise, someone with dichromatic vision is completely missing either their L, M or S cones, and is called either a protanope, deuteranope, or tritanope, respectively.

Protanopia and deuteranopia reduce senstivity to red-green colors, while tritanopia reduces sensitivity to blue-yellow colors.


Methods

Overview

Simulation steps are as follows:

  • Precompute matrices mapping from RGB to opponent color space for range of CVD types and severities.
  • Linearize RGB values from input camera in preparation for calculations in LMS space.
  • Multiply linear RGB value with opponent CVD matrix to get opponent color space representation of what a color deficient person receives as input to their neural pathways.
  • Multiply deficient opponent colorspace representation by the inverse opponent matrix conversion of a normal color perceiver to get trichromat representation.
  • Reapply gamma and display on screen.

Computations

Anomalous trichromacy can be simulated by shifting the sensitivity of the L, M, and S cones in the following ways^1:

  • Protanomaly - Shift L cone toward M cone
  • Deuteranomaly - Shift M cone toward L cone
  • Trianomaly - Shift S cone:

We can convert from LMS to opponent color space using the following transform:

Then, by projecting the opponent color representation of LMS onto the spectral values of the primary phosphors, we arrive at a matrix conversion from RGB to opponent color space:

To obtain a \Gamma representation for given CVD, we simply insert the appropriately morphed cone distribution function and recompute the projection. The following functions are essentially linear interpolations between the L and M cones that also morph the functions to approximately overlap one another at either end of a full shift. Thus, these functions define simulated severities of a deuteranomaly or protanomaly.

Tritanomaly is modeled by simply linearly shifting the S cone distribution function.


Now, having precomputed \Gamma's for each of the CVDs of interest, we can transform each RGB pixel value into the opponent color representation for the color deficient individual. Then, we can return to a trichromatic representation of that signal in RGB space by multiply by the inverse of the opponent color transformation for someone with normal color perception.

Implementation

The method described was implemented on an iPhone to augment the device's camera feed in real time. As a result, the simulation is highly portable and easily distributed.

Since the color transformation matrices do not vary per pixel in a processed image, it was possible to apply the operations in parallel on the iPhone's GPU using the OpenGL shading language GLSL. Without parallelizing the computations on the GPU, interactive framerates would not have been achievable on a device with such limited computation resources.


Results

The following images demonstrate the effect of the three types of dichromacy that can be simulated with the previously discussed algorithm. Note how deuteropes and protanopes have roughly the same experience (difficulty distinguishing between red and green).

Normal Color Vision

Figure 1

Deuteranope

Figure 2

Protanope

Figure 3

Tritanope

Figure 4


Conclusions

Applying the previously described color vision deficiency simulation to a realtime device yielded a very interesting and hopefully useful tool. The simulation can be used to entertain and educate people about CVDs. It can also assist trichromatic designers in creating content for dichromates.

When using the tool it is important to remember that it is impossible to say that what you are seeing exactly reproduces the world as it is seen by any given dichromate. This simulation gives one of an infinite number of actual color representations. One should focus on the relationships between colors and how they become harder to distinguish not on the actual colors on the screen.

References

[1]Gustavo M. Machado, Manuel M. Oliveira, and Leandro A. F. Fernandes "A Physiologically-based Model for Simulation of Color Vision Deficiency". IEEE Transactions on Visualization and Computer Graphics. Volume 15 (2009), Number 6, November/December 2009. pp. 1291-1298.

[2]Hans Brettel, Françoise Viénot, and John D. Mollon, "Computerized simulation of color appearance for dichromats," J. Opt. Soc. Am. A 14, 2647-2655 (1997)

[3]Vischeck

Appendix I - Code and Data

http://itunes.apple.com/us/app/neweyes/id425311528?mt=8&ls=1

(Link may not be active just yet)


Back to Main Page