summaryrefslogtreecommitdiffstats
path: root/srgb.mat
blob: bccf58704d50676cb60c027b6b530642ae6ca3fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# The official primaries for sRGB
rgbxyY = [[0.64 0.30 0.15],
          [0.33, 0.60, 0.06],
	  [0.2126, 0.7152, 0.0722]]

for i = 1:columns(rgbxyY)
    Y_y = rgbxyY(3,i)/rgbxyY(2,i);
    rgbXYZ(2,i) = rgbxyY(3,i)
    rgbXYZ(1,i) = Y_y * rgbxyY(1,i)
    rgbXYZ(3,i) = Y_y * (1 - sum(rgbxyY(1:2,i)))
endfor

XYZrgb = inverse(rgbXYZ)

format long e
rgbXYZ
XYZrgb