Skip to content

Commit 97ec651

Browse files
authored
toru-ver4#201 create config ocio for hdr tools investigation (toru-ver4#202)
* toru-ver4#201 added LINEAR * toru-ver4#201 fixed typo * toru-ver4#201 created Linear TP * toru-ver4#201 Photoshop, Affinity Photo, end. * toru-ver4#201 investigation has finished
1 parent 08b5fb4 commit 97ec651

File tree

54 files changed

+15330
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+15330
-39
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,8 @@ temporary/**/**
207207

208208
2022/09_create_mhc_icc_profile/debug/**
209209
2022/09_create_mhc_icc_profile/lut/**
210+
211+
2023/01_create_ocio_config_for_PS_AF/AfterEffects/**
212+
2023/01_create_ocio_config_for_PS_AF/**/*.cube
213+
2023/01_create_ocio_config_for_PS_AF/**/*.spi1d
214+
2023/01_create_ocio_config_for_PS_AF/**/*.bkp

2019/012_colour_v0.3.14_check/HDR_LogPattern.py

+30-31
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,36 @@ def __init__(self):
2727
self.name = "DCI-P3"
2828

2929

30-
BT709_CS = colour.models.BT709_COLOURSPACE
31-
BT2020_CS = colour.models.BT2020_COLOURSPACE
32-
V_GAMUT_CS = colour.models.V_GAMUT_COLOURSPACE
33-
ALEXA_WIDE_GAMUT_CS = colour.models.ALEXA_WIDE_GAMUT_COLOURSPACE
34-
S_GAMUT3_CINE_CS = colour.models.S_GAMUT3_CINE_COLOURSPACE
35-
S_GAMUT3_CS = colour.models.S_GAMUT3_COLOURSPACE
36-
V_LOG_CS = colour.models.V_GAMUT_COLOURSPACE
37-
ALEXA_WIDE_GAMUT_CS = colour.models.ALEXA_WIDE_GAMUT_COLOURSPACE
38-
RED_WIDE_GAMUT_RGB_CS = colour.models.RED_WIDE_GAMUT_RGB_COLOURSPACE
39-
DCI_P3_CS = DciP3ColorSpace()
40-
SRGB_CS = colour.models.sRGB_COLOURSPACE
41-
ACES_AP1_CS = colour.models.ACES_CG_COLOURSPACE
42-
ACES_AP0_CS = colour.models.ACES_2065_1_COLOURSPACE
43-
44-
PARAM_LIST = [{'tf': tf.GAMMA24, 'cs': BT709_CS, 'wp': 'D65'},
45-
{'tf': tf.GAMMA24, 'cs': BT2020_CS, 'wp': 'D65'},
46-
{'tf': tf.HLG, 'cs': BT2020_CS, 'wp': 'D65'},
47-
{'tf': tf.ST2084, 'cs': BT2020_CS, 'wp': 'D65'},
48-
{'tf': tf.ST2084, 'cs': DCI_P3_CS, 'wp': 'D65'},
49-
{'tf': tf.SLOG3, 'cs': S_GAMUT3_CS, 'wp': 'D65'},
50-
{'tf': tf.SLOG3_REF, 'cs': S_GAMUT3_CS, 'wp': 'D65'},
51-
{'tf': tf.VLOG, 'cs': V_LOG_CS, 'wp': 'D65'},
52-
{'tf': tf.LOGC, 'cs': ALEXA_WIDE_GAMUT_CS, 'wp': 'D65'},
53-
{'tf': tf.LOGC, 'cs': BT2020_CS, 'wp': 'D65'},
54-
{'tf': tf.LOG3G10, 'cs': RED_WIDE_GAMUT_RGB_CS, 'wp': 'D65'},
55-
{'tf': tf.LOG3G12, 'cs': RED_WIDE_GAMUT_RGB_CS, 'wp': 'D65'},
56-
{'tf': tf.LOG3G10, 'cs': BT2020_CS, 'wp': 'D65'},
57-
{'tf': tf.LOG3G12, 'cs': BT2020_CS, 'wp': 'D65'},
58-
{'tf': tf.ST2084, 'cs': ACES_AP1_CS, 'wp': 'D60'},
59-
{'tf': tf.ST2084, 'cs': ACES_AP0_CS, 'wp': 'D60'}]
60-
# PARAM_LIST = [{'tf': tf.SLOG3_REF, 'cs': S_GAMUT3_CS, 'wp': 'D65'}]
30+
BT709_CS = colour.models.RGB_COLOURSPACE_BT709
31+
BT2020_CS = colour.models.RGB_COLOURSPACE_BT2020
32+
V_GAMUT_CS = colour.models.RGB_COLOURSPACE_V_GAMUT
33+
ALEXA_WIDE_GAMUT_CS = colour.models.RGB_COLOURSPACE_ARRI_WIDE_GAMUT_3
34+
S_GAMUT3_CINE_CS = colour.models.RGB_COLOURSPACE_S_GAMUT3_CINE
35+
S_GAMUT3_CS = colour.models.RGB_COLOURSPACE_S_GAMUT3
36+
V_LOG_CS = colour.models.RGB_COLOURSPACE_V_GAMUT
37+
RED_WIDE_GAMUT_RGB_CS = colour.models.RGB_COLOURSPACE_RED_WIDE_GAMUT_RGB
38+
DCI_P3_CS = colour.models.RGB_COLOURSPACE_P3_D65
39+
SRGB_CS = colour.models.RGB_COLOURSPACE_sRGB
40+
ACES_AP1_CS = colour.models.RGB_COLOURSPACE_ACESCG
41+
ACES_AP0_CS = colour.models.RGB_COLOURSPACE_ACES2065_1
42+
43+
# PARAM_LIST = [{'tf': tf.GAMMA24, 'cs': BT709_CS, 'wp': 'D65'},
44+
# {'tf': tf.GAMMA24, 'cs': BT2020_CS, 'wp': 'D65'},
45+
# {'tf': tf.HLG, 'cs': BT2020_CS, 'wp': 'D65'},
46+
# {'tf': tf.ST2084, 'cs': BT2020_CS, 'wp': 'D65'},
47+
# {'tf': tf.ST2084, 'cs': DCI_P3_CS, 'wp': 'D65'},
48+
# {'tf': tf.SLOG3, 'cs': S_GAMUT3_CS, 'wp': 'D65'},
49+
# {'tf': tf.SLOG3_REF, 'cs': S_GAMUT3_CS, 'wp': 'D65'},
50+
# {'tf': tf.VLOG, 'cs': V_LOG_CS, 'wp': 'D65'},
51+
# {'tf': tf.LOGC, 'cs': ALEXA_WIDE_GAMUT_CS, 'wp': 'D65'},
52+
# {'tf': tf.LOGC, 'cs': BT2020_CS, 'wp': 'D65'},
53+
# {'tf': tf.LOG3G10, 'cs': RED_WIDE_GAMUT_RGB_CS, 'wp': 'D65'},
54+
# {'tf': tf.LOG3G12, 'cs': RED_WIDE_GAMUT_RGB_CS, 'wp': 'D65'},
55+
# {'tf': tf.LOG3G10, 'cs': BT2020_CS, 'wp': 'D65'},
56+
# {'tf': tf.LOG3G12, 'cs': BT2020_CS, 'wp': 'D65'},
57+
# {'tf': tf.ST2084, 'cs': ACES_AP1_CS, 'wp': 'D60'},
58+
# {'tf': tf.ST2084, 'cs': ACES_AP0_CS, 'wp': 'D60'}]
59+
PARAM_LIST = [{'tf': tf.LINEAR, 'cs': ACES_AP0_CS, 'wp': 'D60'}]
6160

6261

6362
class TpgControl:

2019/012_colour_v0.3.14_check/TpgDraw.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ def get_color_checker_rgb_value(self):
405405
"""
406406
24パターンの Color Checker の RGB値を得る
407407
"""
408-
colour_checker_param = colour.COLOURCHECKERS.get('ColorChecker 2005')
408+
colour_checker_param\
409+
= colour.CCS_COLOURCHECKERS.get('ColorChecker 2005')
409410

410411
# 今回の処理では必要ないデータもあるので xyY と whitepoint だけ抽出
411412
# -------------------------------------------------------------
@@ -417,7 +418,7 @@ def get_color_checker_rgb_value(self):
417418
large_xyz = colour.models.xyY_to_XYZ(temp_xyY)
418419

419420
rgb_white_point\
420-
= colour.colorimetry.ILLUMINANTS['cie_2_1931'][self.white_point]
421+
= colour.colorimetry.CCS_ILLUMINANTS['cie_2_1931'][self.white_point]
421422

422423
illuminant_XYZ = whitepoint # ColorCheckerのオリジナルデータの白色点
423424
illuminant_RGB = rgb_white_point # RGBの白色点を設定
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
debug code
4+
==========
5+
6+
"""
7+
8+
# import standard libraries
9+
import os
10+
11+
# import third-party libraries
12+
import numpy as np
13+
14+
# import my libraries
15+
import transfer_functions as tf
16+
17+
# information
18+
__author__ = 'Toru Yoshihara'
19+
__copyright__ = 'Copyright (C) 2022 - Toru Yoshihara'
20+
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
21+
__maintainer__ = 'Toru Yoshihara'
22+
__email__ = 'toru.ver.11 at-sign gmail.com'
23+
24+
__all__ = []
25+
26+
27+
def calc_10bit_st2084_cv(linear_val=0.18):
28+
cv = np.round(tf.oetf_from_luminance(linear_val*100, tf.ST2084) * 1023)
29+
return np.uint16(cv)
30+
31+
32+
if __name__ == '__main__':
33+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
34+
print(calc_10bit_st2084_cv(0.08))
35+
print(calc_10bit_st2084_cv(0.10))
36+
print(calc_10bit_st2084_cv(0.18))
37+
print(calc_10bit_st2084_cv(1.0))
38+
print(calc_10bit_st2084_cv(10))
39+
print(calc_10bit_st2084_cv(100))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
4+
"""
5+
6+
# import standard libraries
7+
import os
8+
9+
# import third-party libraries
10+
import numpy as np
11+
from colour.io import write_image, read_image
12+
13+
# import my libraries
14+
import test_pattern_generator2 as tpg
15+
import transfer_functions as tf
16+
import plot_utility as pu
17+
18+
# information
19+
__author__ = 'Toru Yoshihara'
20+
__copyright__ = 'Copyright (C) 2022 - Toru Yoshihara'
21+
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
22+
__maintainer__ = 'Toru Yoshihara'
23+
__email__ = 'toru.ver.11 at-sign gmail.com'
24+
25+
__all__ = []
26+
27+
28+
def create_pq_based_ramp_exr():
29+
width = 1920
30+
height = 1080
31+
out_fname = "./img/pq_based_ramp_linear.exr"
32+
x = np.linspace(0, 1, width)
33+
linear = tf.eotf_to_luminance(x, tf.ST2084) / 100
34+
img = tpg.h_mono_line_to_img(linear, height)
35+
36+
write_image(img, out_fname)
37+
38+
39+
def plot_Ae_HDR10_out_with_white(graph_name="./img/out_w203.png"):
40+
width = 1920
41+
42+
fname_list = [
43+
"./img/Ae_out_Chara/Ae_out_chara_ProRes_W-none.tif",
44+
"./img/Ae_out_Chara/Ae_out_chara_ProRes_W-100.tif",
45+
"./img/Ae_out_Chara/Ae_out_chara_ProRes_W-203.tif",
46+
"./img/Ae_out_Chara/Ae_out_chara_ProRes_W-10000.tif"]
47+
profile_list = [
48+
"Rec.2100 PQ", "Rec.2100 PQ W100", "Rec.2100 PQ W203",
49+
"Rec.2100 PQ W10000"]
50+
51+
def get_linear(fname):
52+
img = tpg.img_read_as_float(fname)
53+
x_ae = img[0, :, 1] # extract Green line data
54+
ae_luminance = tf.eotf_to_luminance(x_ae, tf.ST2084)
55+
return ae_luminance
56+
57+
chara_list = [get_linear(fname) for fname in fname_list]
58+
59+
x = np.linspace(0, 1, width)
60+
ref_luminance = tf.eotf_to_luminance(x, tf.ST2084)
61+
62+
fig, ax1 = pu.plot_1_graph(
63+
fontsize=20,
64+
figsize=(10, 8),
65+
bg_color=(0.96, 0.96, 0.96),
66+
graph_title="Ae In-Out Characteristics (ProRes 4444)",
67+
graph_title_size=None,
68+
xlabel="Input Luminance [cd/m2]",
69+
ylabel="Output LUminance [cd/m2]",
70+
axis_label_size=None,
71+
legend_size=17,
72+
xlim=[0.009, 15000],
73+
ylim=[0.009, 15000],
74+
xtick=None,
75+
ytick=None,
76+
xtick_size=None, ytick_size=None,
77+
linewidth=3,
78+
minor_xtick_num=None,
79+
minor_ytick_num=None)
80+
pu.log_scale_settings(ax1=ax1)
81+
for idx, y in enumerate(chara_list):
82+
ax1.plot(ref_luminance, y, label=profile_list[idx])
83+
pu.show_and_save(
84+
fig=fig, legend_loc='upper left', save_fname=graph_name,
85+
show=False)
86+
87+
88+
def plot_Ae_HDR10_exr_out_with_white(graph_name="./img/out.png"):
89+
width = 1920
90+
91+
fname_list = [
92+
"./AfterEffects/Comp 1/Comp 1_W-none_00000.exr",
93+
"./AfterEffects/Comp 1/Comp 1_W-100_00000.exr",
94+
"./AfterEffects/Comp 1/Comp 1_W-203_00000.exr",
95+
"./AfterEffects/Comp 1/Comp 1_W-10000_00000.exr"]
96+
profile_list = [
97+
"Rec.2100 PQ", "Rec.2100 PQ W100", "Rec.2100 PQ W203",
98+
"Rec.2100 PQ W10000"]
99+
100+
def get_linear(fname):
101+
img = read_image(fname)
102+
x_ae = img[0, :, 1] # extract Green line data
103+
ae_luminance = x_ae * 100
104+
return ae_luminance
105+
106+
chara_list = [get_linear(fname) for fname in fname_list]
107+
108+
x = np.linspace(0, 1, width)
109+
ref_luminance = tf.eotf_to_luminance(x, tf.ST2084)
110+
111+
fig, ax1 = pu.plot_1_graph(
112+
fontsize=20,
113+
figsize=(10, 8),
114+
bg_color=(0.96, 0.96, 0.96),
115+
graph_title="Ae In-Out Characteristics (EXR Linear)",
116+
graph_title_size=None,
117+
xlabel="Input Luminance [cd/m2]",
118+
ylabel="Output LUminance [cd/m2]",
119+
axis_label_size=None,
120+
legend_size=17,
121+
xlim=[0.009, 15000],
122+
ylim=[0.009, 15000],
123+
xtick=None,
124+
ytick=None,
125+
xtick_size=None, ytick_size=None,
126+
linewidth=3,
127+
minor_xtick_num=None,
128+
minor_ytick_num=None)
129+
pu.log_scale_settings(ax1=ax1)
130+
for idx, y in enumerate(chara_list):
131+
ax1.plot(ref_luminance, y, label=profile_list[idx])
132+
pu.show_and_save(
133+
fig=fig, legend_loc='upper left', save_fname=graph_name,
134+
show=False)
135+
136+
137+
def plot_Ae_HDR10_exr_nl_out_with_white(graph_name="./img/out.png"):
138+
width = 1920
139+
140+
fname_list = [
141+
"./AfterEffects/Comp 1/Comp 1_NL_W-none_00000.exr",
142+
"./AfterEffects/Comp 1/Comp 1_NL_W-100_00000.exr",
143+
"./AfterEffects/Comp 1/Comp 1_NL_W-203_00000.exr",
144+
"./AfterEffects/Comp 1/Comp 1_NL_W-10000_00000.exr"]
145+
profile_list = [
146+
"Rec.2100 PQ", "Rec.2100 PQ W100", "Rec.2100 PQ W203",
147+
"Rec.2100 PQ W10000"]
148+
149+
def get_linear(fname):
150+
img = read_image(fname)
151+
x_ae = img[0, :, 1] # extract Green line data
152+
ae_luminance = tf.eotf_to_luminance(x_ae, tf.ST2084)
153+
return ae_luminance
154+
155+
chara_list = [get_linear(fname) for fname in fname_list]
156+
157+
x = np.linspace(0, 1, width)
158+
ref_luminance = tf.eotf_to_luminance(x, tf.ST2084)
159+
160+
fig, ax1 = pu.plot_1_graph(
161+
fontsize=20,
162+
figsize=(10, 8),
163+
bg_color=(0.96, 0.96, 0.96),
164+
graph_title="Ae In-Out Characteristics (EXR Non-linear)",
165+
graph_title_size=None,
166+
xlabel="Input Luminance [cd/m2]",
167+
ylabel="Output LUminance [cd/m2]",
168+
axis_label_size=None,
169+
legend_size=17,
170+
xlim=[0.009, 15000],
171+
ylim=[0.009, 15000],
172+
xtick=None,
173+
ytick=None,
174+
xtick_size=None, ytick_size=None,
175+
linewidth=3,
176+
minor_xtick_num=None,
177+
minor_ytick_num=None)
178+
pu.log_scale_settings(ax1=ax1)
179+
for idx, y in enumerate(chara_list):
180+
ax1.plot(ref_luminance, y, label=profile_list[idx])
181+
pu.show_and_save(
182+
fig=fig, legend_loc='upper left', save_fname=graph_name,
183+
show=False)
184+
185+
186+
def plot_Ae_HDR10_exr_nl_out_vari_prj_white(graph_name="./img/out.png"):
187+
"""
188+
Plot transfer characteristics of the working color space.
189+
Output color space is fixed to "Rec.2100 PQ" (with no white point).
190+
"""
191+
width = 1920
192+
193+
fname_list = [
194+
"./AfterEffects/Comp 1/prj_w_W-none _00000.exr",
195+
"./AfterEffects/Comp 1/prj_w_W-100 _00000.exr",
196+
"./AfterEffects/Comp 1/prj_w_W-203 _00000.exr",
197+
"./AfterEffects/Comp 1/prj_w_W-10000 _00000.exr",
198+
]
199+
profile_list = [
200+
"Rec.2100 PQ",
201+
"Rec.2100 PQ W100",
202+
"Rec.2100 PQ W203",
203+
"Rec.2100 PQ W10000"
204+
]
205+
206+
def get_linear(fname):
207+
img = read_image(fname)
208+
x_ae = img[0, :, 1] # extract Green line data
209+
ae_luminance = tf.eotf_to_luminance(x_ae, tf.ST2084)
210+
return ae_luminance
211+
212+
chara_list = [get_linear(fname) for fname in fname_list]
213+
214+
x = np.linspace(0, 1, width)
215+
ref_luminance = tf.eotf_to_luminance(x, tf.ST2084)
216+
217+
fig, ax1 = pu.plot_1_graph(
218+
fontsize=20,
219+
figsize=(10, 8),
220+
bg_color=(0.96, 0.96, 0.96),
221+
graph_title="Transfer characteristics of the working color space",
222+
graph_title_size=None,
223+
xlabel="Input Luminance [cd/m2]",
224+
ylabel="Output LUminance [cd/m2]",
225+
axis_label_size=None,
226+
legend_size=17,
227+
xlim=[0.009, 15000],
228+
ylim=[0.009, 15000],
229+
xtick=None,
230+
ytick=None,
231+
xtick_size=None, ytick_size=None,
232+
linewidth=3,
233+
minor_xtick_num=None,
234+
minor_ytick_num=None)
235+
pu.log_scale_settings(ax1=ax1)
236+
for idx, y in enumerate(chara_list):
237+
ax1.plot(ref_luminance, y, label=profile_list[idx])
238+
pu.show_and_save(
239+
fig=fig, legend_loc='upper left', save_fname=graph_name,
240+
show=False)
241+
242+
243+
if __name__ == '__main__':
244+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
245+
# create_pq_based_ramp_exr()
246+
# plot_Ae_HDR10_out_with_white(
247+
# graph_name="./img/Ae_Out_ProRes.png")
248+
# plot_Ae_HDR10_exr_out_with_white(
249+
# graph_name="./img/Ae_Out_Exr_L.png")
250+
# plot_Ae_HDR10_exr_nl_out_with_white(
251+
# graph_name="./img/Ae_Out_Exr_NL_png")
252+
plot_Ae_HDR10_exr_nl_out_vari_prj_white(
253+
graph_name="./img/Ae_working_space_tf.png")

0 commit comments

Comments
 (0)