File: matrix.wxm

package info (click to toggle)
node-husl 6.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,820 kB
  • ctags: 147
  • sloc: java: 612; ansic: 285; makefile: 11; sh: 2
file content (53 lines) | stat: -rw-r--r-- 1,569 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/
/* [ Created with wxMaxima version 15.04.0 ] */

/* [wxMaxima: input   start ] */
/* Authors: Alexei Boronine, Bastien Dejean */

/* Matrices generated with the following algorithm:                 */
/* http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html */
/* Which makes use of this transformation:                          */
/* http://www.brucelindbloom.com/index.html?Eqn_xyY_to_XYZ.html     */

xyY_to_XYZ(x, y, Y) := [x * Y / y, Y, (1 - x - y) * Y / y];

/* sRGB primaries with D65 white point               */
/* http://en.wikipedia.org/wiki/SRGB#The_sRGB_gamut  */
/* http://en.wikipedia.org/wiki/Illuminant_D65       */

x_r: rat(0.64);
y_r: rat(0.33);
x_g: rat(0.30);
y_g: rat(0.60);
x_b: rat(0.15);
y_b: rat(0.06);
x_w: rat(0.3127);
y_w: rat(0.3290);

[X_r, Y_r, Z_r]: xyY_to_XYZ(x_r, y_r, 1);
[X_g, Y_g, Z_g]: xyY_to_XYZ(x_g, y_g, 1);
[X_b, Y_b, Z_b]: xyY_to_XYZ(x_b, y_b, 1);
[X_w, Y_w, Z_w]: xyY_to_XYZ(x_w, y_w, 1);
 
M_P: matrix([X_r, X_g, X_b],
            [Y_r, Y_g, Y_b],
            [Z_r, Z_g, Z_b]);
 
M_S: invert(M_P) . [X_w, Y_w, Z_w];

M_RGB_XYZ: M_P * transpose(addcol(M_S, M_S, M_S));
M_XYZ_RGB: invert(M_RGB_XYZ);

fpprec: 16;
bfloat(M_RGB_XYZ);
bfloat(M_XYZ_RGB);

/* XYZ tristimulus values for D65, used as reference white point here:
http://www.brucelindbloom.com/index.html?Eqn_xyY_to_XYZ.html */

xyY_to_XYZ(rat(0.3127), rat(0.3290), 1);

/* [wxMaxima: input   end   ] */

/* Maxima can't load/batch files which end with a comment! */
"Created with wxMaxima"$