-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaces_tonescale_1000nits.py
63 lines (55 loc) · 1.48 KB
/
aces_tonescale_1000nits.py
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
54
55
56
57
58
59
60
61
62
# Stanard ACES 1000 nits curve.
from aceslib.tonescales import *
def aces_tonescale_1000nits(x):
y = segmented_spline_c5_fwd(x)
z = segmented_spline_c9_fwd(y, ODT_1000nits)
return z
print " mid-gray:", aces_tonescale_1000nits(0.18)
print "paper-white:", aces_tonescale_1000nits(1.0)
print " mapping:"
for i in range(24):
x = 0.18 * pow(2, i - 12)
y = aces_tonescale_1000nits(x)
print " %10.5f %10.5f" %(x, y)
# Plot the mapping via desmos.
html = '''
<script src="https://www.desmos.com/api/v1.3/calculator.js?apiKey=dcb31709b452b1cf9dc26972add0fda6"></script>
<div id="calculator"></div>
<script>
var elt = document.getElementById('calculator');
var calculator = Desmos.GraphingCalculator(elt);
calculator.setExpression({
type: 'table',
columns: [
{
latex: 'x',
values: $Xs$
},
{
latex: 'y',
values: $Ys$,
columnMode: Desmos.ColumnModes.POINTS_AND_LINES
}
]
});
calculator.setMathBounds({
left: -13,
right: 13,
bottom: -100,
top: 1100
});
</script>
'''
Xs = [i - 12 for i in range(24)]
Ys = [0.0] * 24
for i in range(24):
x = 0.18 * pow(2, Xs[i])
y = aces_tonescale_1000nits(x)
Ys[i] = y
html = html.replace("$Xs$", str(Xs))
html = html.replace("$Ys$", str(Ys))
f = open("graph.html", 'w')
f.write(html)
f.close()
import os
os.system("explorer graph.html")