Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Here is a matlab script for calculating a direct transformation matrix for daltonization.
- %
- % These are the results:
- %
- %Protanope:
- %ans =
- %
- % 1.0000 0 0
- % 0.5089 0.4911 0.0000
- % 0.6173 -0.6173 1.0000
- %
- %Deuteranope:
- %ans =
- %
- % 1.0000 0 0
- % 0.2023 0.7977 -0.0000
- % 0.5174 -0.5174 1.0000
- %
- %Trianope:
- %ans =
- %
- % 1.0000 0 0
- % -0.1385 1.1385 0.0000
- % 3.3656 -3.3656 1.0000
- %
- % Used http://mudcu.be/labs/Color-Vision/Javascript/Color.Vision.Daltonize.js as reference
- %
- function daltonize
- function ret = calculateMatrix(CVDmatrix)
- LMSrgb = [17.8824 43.5161 4.11935;
- 3.45565 27.1554 3.86714;
- 0.0299566 0.184309 1.46709];
- RGBlms = [ 0.0809444479 -0.130504409 0.116721066;
- -0.0102485335 0.0540193266 -0.113614708;
- -0.000365296938 -0.00412161469 0.693511405];
- RGBrgb = RGBlms * CVDmatrix * LMSrgb;
- errrgb = eye(3) - RGBrgb;
- RRGGBBrgb = [0 0 0; 0.7 1 0; 0.7 0 1] * errrgb;
- ret = RRGGBBrgb + eye(3);
- end
- Protanope = [0.0, 2.02344, -2.52581,
- 0.0, 1.0, 0.0,
- 0.0, 0.0, 1.0];
- Deuteranope = [1.0, 0.0, 0.0;
- 0.494207, 0.0, 1.24827;
- 0.0, 0.0, 1.0];
- Trianope = [1.0, 0.0, 0.0;
- 0.0, 1.0, 0.0;
- -0.395913, 0.801109, 0.0];
- fprintf('Protanope:');
- calculateMatrix(Protanope)
- fprintf('Deuteranope:');
- calculateMatrix(Deuteranope)
- fprintf('Trianope:');
- calculateMatrix(Trianope)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement