Coverage for models/rgb/datasets/sony.py: 0%
72 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-16 22:49 +1300
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-16 22:49 +1300
1"""
2Sony Colourspaces
3=================
5Define the *Sony* colourspaces:
7- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT`.
8- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT3`.
9- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT3_CINE`.
10- :attr:`colour.models.RGB_COLOURSPACE_VENICE_S_GAMUT3`.
11- :attr:`colour.models.RGB_COLOURSPACE_VENICE_S_GAMUT3_CINE`.
13Notes
14-----
15- The *Venice S-Gamut3* and *Venice S-Gamut3.Cine* primaries and whitepoint
16 were derived with the following `Google Colab Notebook \
17<https://colab.research.google.com/drive/1ZGTij7jT8eZRMPUkyWlv_x5ix5Q5twMB>`__.
19References
20----------
21- :cite:`Gaggioni` : Gaggioni, H., Dhanendra, P., Yamashita, J., Kawada, N.,
22 Endo, K., & Clark, C. (n.d.). S-Log: A new LUT for digital production
23 mastering and interchange applications (Vol. 709, pp. 1-13).
24 http://pro.sony.com/bbsccms/assets/files/mkt/cinema/solutions/slog_manual.pdf
25- :cite:`SonyCorporation` : Sony Corporation. (n.d.). S-Log Whitepaper (pp.
26 1-17). http://www.theodoropoulos.info/attachments/076_on%20S-Log.pdf
27- :cite:`SonyCorporationd` : Sony Corporation. (n.d.). Technical Summary
28 for S-Gamut3.Cine/S-Log3 and S-Gamut3/S-Log3 (pp. 1-7).
29 http://community.sony.com/sony/attachments/sony/\
30large-sensor-camera-F5-F55/12359/2/\
31TechnicalSummary_for_S-Gamut3Cine_S-Gamut3_S-Log3_V1_00.pdf
32- :cite:`SonyCorporatione` : Sony Corporation. (n.d.).
33 S-Gamut3_S-Gamut3Cine_Matrix.xlsx.
34 https://community.sony.com/sony/attachments/sony/\
35large-sensor-camera-F5-F55/12359/3/S-Gamut3_S-Gamut3Cine_Matrix.xlsx
36- :cite:`SonyElectronicsCorporation2020` : Sony Electronics Corporation.
37 (2020). IDT.Sony.Venice_SLog3_SGamut3.ctl. https://github.com/ampas/\
38aces-dev/blob/710ecbe52c87ce9f4a1e02c8ddf7ea0d6b611cc8/transforms/ctl/idt/\
39vendorSupplied/sony/IDT.Sony.Venice_SLog3_SGamut3.ctl
40- :cite:`SonyElectronicsCorporation2020a` : Sony Electronics Corporation.
41 (2020). IDT.Sony.Venice_SLog3_SGamut3Cine.ctl. https://github.com/ampas/\
42aces-dev/blob/710ecbe52c87ce9f4a1e02c8ddf7ea0d6b611cc8/transforms/ctl/idt/\
43vendorSupplied/sony/IDT.Sony.Venice_SLog3_SGamut3Cine.ctl
44"""
46from __future__ import annotations
48import typing
50import numpy as np
52from colour.colorimetry import CCS_ILLUMINANTS
54if typing.TYPE_CHECKING:
55 from colour.hints import NDArrayFloat
57from colour.models.rgb import (
58 RGB_Colourspace,
59 log_decoding_SLog2,
60 log_decoding_SLog3,
61 log_encoding_SLog2,
62 log_encoding_SLog3,
63 normalised_primary_matrix,
64)
66__author__ = "Colour Developers"
67__copyright__ = "Copyright 2013 Colour Developers"
68__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
69__maintainer__ = "Colour Developers"
70__email__ = "colour-developers@colour-science.org"
71__status__ = "Production"
73__all__ = [
74 "PRIMARIES_S_GAMUT",
75 "WHITEPOINT_NAME_S_GAMUT",
76 "CCS_WHITEPOINT_S_GAMUT",
77 "MATRIX_S_GAMUT_TO_XYZ",
78 "MATRIX_XYZ_TO_S_GAMUT",
79 "RGB_COLOURSPACE_S_GAMUT",
80 "PRIMARIES_S_GAMUT3",
81 "WHITEPOINT_NAME_S_GAMUT3",
82 "CCS_WHITEPOINT_S_GAMUT3",
83 "MATRIX_S_GAMUT3_TO_XYZ",
84 "MATRIX_XYZ_TO_S_GAMUT3",
85 "RGB_COLOURSPACE_S_GAMUT3",
86 "PRIMARIES_S_GAMUT3_CINE",
87 "WHITEPOINT_NAME_S_GAMUT3_CINE",
88 "CCS_WHITEPOINT_S_GAMUT3_CINE",
89 "MATRIX_S_GAMUT3_CINE_TO_XYZ",
90 "MATRIX_XYZ_TO_S_GAMUT3_CINE",
91 "RGB_COLOURSPACE_S_GAMUT3_CINE",
92 "PRIMARIES_VENICE_S_GAMUT3",
93 "WHITEPOINT_NAME_VENICE_S_GAMUT3",
94 "CCS_WHITEPOINT_VENICE_S_GAMUT3",
95 "MATRIX_VENICE_S_GAMUT3_TO_XYZ",
96 "MATRIX_XYZ_TO_VENICE_S_GAMUT3",
97 "RGB_COLOURSPACE_VENICE_S_GAMUT3",
98 "PRIMARIES_VENICE_S_GAMUT3_CINE",
99 "WHITEPOINT_NAME_VENICE_S_GAMUT3_CINE",
100 "CCS_WHITEPOINT_VENICE_S_GAMUT3_CINE",
101 "MATRIX_VENICE_S_GAMUT3_CINE_TO_XYZ",
102 "MATRIX_XYZ_TO_VENICE_S_GAMUT3_CINE",
103 "RGB_COLOURSPACE_VENICE_S_GAMUT3_CINE",
104]
106PRIMARIES_S_GAMUT: NDArrayFloat = np.array(
107 [
108 [0.7300, 0.2800],
109 [0.1400, 0.8550],
110 [0.1000, -0.0500],
111 ]
112)
113"""*S-Gamut* colourspace primaries."""
115WHITEPOINT_NAME_S_GAMUT: str = "D65"
116"""*S-Gamut* colourspace whitepoint name."""
118CCS_WHITEPOINT_S_GAMUT: NDArrayFloat = CCS_ILLUMINANTS[
119 "CIE 1931 2 Degree Standard Observer"
120][WHITEPOINT_NAME_S_GAMUT]
121"""*S-Gamut* colourspace whitepoint chromaticity coordinates."""
123MATRIX_S_GAMUT_TO_XYZ: NDArrayFloat = np.array(
124 [
125 [0.7064827132, 0.1288010498, 0.1151721641],
126 [0.2709796708, 0.7866064112, -0.0575860820],
127 [-0.0096778454, 0.0046000375, 1.0941355587],
128 ]
129)
130"""*S-Gamut* colourspace to *CIE XYZ* tristimulus values matrix."""
132MATRIX_XYZ_TO_S_GAMUT: NDArrayFloat = np.array(
133 [
134 [1.5073998991, -0.2458221374, -0.1716116808],
135 [-0.5181517271, 1.3553912409, 0.1258786682],
136 [0.0155116982, -0.0078727714, 0.9119163656],
137 ]
138)
139"""*CIE XYZ* tristimulus values to *S-Gamut* colourspace matrix."""
141RGB_COLOURSPACE_S_GAMUT: RGB_Colourspace = RGB_Colourspace(
142 "S-Gamut",
143 PRIMARIES_S_GAMUT,
144 CCS_WHITEPOINT_S_GAMUT,
145 WHITEPOINT_NAME_S_GAMUT,
146 MATRIX_S_GAMUT_TO_XYZ,
147 MATRIX_XYZ_TO_S_GAMUT,
148 log_encoding_SLog2,
149 log_decoding_SLog2,
150)
151RGB_COLOURSPACE_S_GAMUT.__doc__ = """
152*S-Gamut* colourspace.
154References
155----------
156:cite:`Gaggioni`, :cite:`SonyCorporation`
157"""
159PRIMARIES_S_GAMUT3: NDArrayFloat = PRIMARIES_S_GAMUT
160"""*S-Gamut3* colourspace primaries."""
162WHITEPOINT_NAME_S_GAMUT3: str = WHITEPOINT_NAME_S_GAMUT
163"""*S-Gamut3* colourspace whitepoint name."""
165CCS_WHITEPOINT_S_GAMUT3: NDArrayFloat = CCS_WHITEPOINT_S_GAMUT
166"""*S-Gamut3* colourspace whitepoint chromaticity coordinates."""
168MATRIX_S_GAMUT3_TO_XYZ: NDArrayFloat = MATRIX_S_GAMUT_TO_XYZ
169"""*S-Gamut3* colourspace to *CIE XYZ* tristimulus values matrix."""
171MATRIX_XYZ_TO_S_GAMUT3: NDArrayFloat = MATRIX_XYZ_TO_S_GAMUT
172"""*CIE XYZ* tristimulus values to *S-Gamut3* colourspace matrix."""
174RGB_COLOURSPACE_S_GAMUT3: RGB_Colourspace = RGB_Colourspace(
175 "S-Gamut3",
176 PRIMARIES_S_GAMUT3,
177 CCS_WHITEPOINT_S_GAMUT3,
178 WHITEPOINT_NAME_S_GAMUT3,
179 MATRIX_S_GAMUT3_TO_XYZ,
180 MATRIX_XYZ_TO_S_GAMUT3,
181 log_encoding_SLog3,
182 log_decoding_SLog3,
183)
184RGB_COLOURSPACE_S_GAMUT3.__doc__ = """
185*S-Gamut3* colourspace.
187References
188----------
189:cite:`SonyCorporationd`
190"""
192PRIMARIES_S_GAMUT3_CINE: NDArrayFloat = np.array(
193 [
194 [0.76600, 0.27500],
195 [0.22500, 0.80000],
196 [0.08900, -0.08700],
197 ]
198)
199"""*S-Gamut3.Cine* colourspace primaries."""
201WHITEPOINT_NAME_S_GAMUT3_CINE: str = WHITEPOINT_NAME_S_GAMUT
202"""*S-Gamut3.Cine* colourspace whitepoint name."""
204CCS_WHITEPOINT_S_GAMUT3_CINE: NDArrayFloat = CCS_WHITEPOINT_S_GAMUT
205"""*S-Gamut3.Cine* colourspace whitepoint chromaticity coordinates."""
207MATRIX_S_GAMUT3_CINE_TO_XYZ: NDArrayFloat = np.array(
208 [
209 [0.5990839208, 0.2489255161, 0.1024464902],
210 [0.2150758201, 0.8850685017, -0.1001443219],
211 [-0.0320658495, -0.0276583907, 1.1487819910],
212 ]
213)
214"""*S-Gamut3.Cine* colourspace to *CIE XYZ* tristimulus values matrix."""
216MATRIX_XYZ_TO_S_GAMUT3_CINE: NDArrayFloat = np.array(
217 [
218 [1.8467789693, -0.5259861230, -0.2105452114],
219 [-0.4441532629, 1.2594429028, 0.1493999729],
220 [0.0408554212, 0.0156408893, 0.8682072487],
221 ]
222)
223"""*CIE XYZ* tristimulus values to *S-Gamut3.Cine* colourspace matrix."""
225RGB_COLOURSPACE_S_GAMUT3_CINE: RGB_Colourspace = RGB_Colourspace(
226 "S-Gamut3.Cine",
227 PRIMARIES_S_GAMUT3_CINE,
228 CCS_WHITEPOINT_S_GAMUT3_CINE,
229 WHITEPOINT_NAME_S_GAMUT3_CINE,
230 MATRIX_S_GAMUT3_CINE_TO_XYZ,
231 MATRIX_XYZ_TO_S_GAMUT3_CINE,
232 log_encoding_SLog3,
233 log_decoding_SLog3,
234)
235RGB_COLOURSPACE_S_GAMUT3_CINE.__doc__ = """
236*S-Gamut3.Cine* colourspace.
238References
239----------
240:cite:`SonyCorporatione`
241"""
243PRIMARIES_VENICE_S_GAMUT3: NDArrayFloat = np.array(
244 [
245 [0.740464264304292, 0.279364374750660],
246 [0.089241145423286, 0.893809528608105],
247 [0.110488236673827, -0.052579333080476],
248 ]
249)
250"""*Venice S-Gamut3* colourspace primaries."""
252WHITEPOINT_NAME_VENICE_S_GAMUT3: str = WHITEPOINT_NAME_S_GAMUT
253"""*Venice S-Gamut3* colourspace whitepoint name."""
255CCS_WHITEPOINT_VENICE_S_GAMUT3: NDArrayFloat = CCS_WHITEPOINT_S_GAMUT
256"""*Venice S-Gamut3* colourspace whitepoint chromaticity coordinates."""
258MATRIX_VENICE_S_GAMUT3_TO_XYZ: NDArrayFloat = normalised_primary_matrix(
259 PRIMARIES_VENICE_S_GAMUT3, CCS_WHITEPOINT_VENICE_S_GAMUT3
260)
261"""*Venice S-Gamut3* colourspace to *CIE XYZ* tristimulus values matrix."""
263MATRIX_XYZ_TO_VENICE_S_GAMUT3: NDArrayFloat = np.linalg.inv(
264 MATRIX_VENICE_S_GAMUT3_TO_XYZ
265)
266"""*CIE XYZ* tristimulus values to *Venice S-Gamut3* colourspace matrix."""
268RGB_COLOURSPACE_VENICE_S_GAMUT3: RGB_Colourspace = RGB_Colourspace(
269 "Venice S-Gamut3",
270 PRIMARIES_VENICE_S_GAMUT3,
271 CCS_WHITEPOINT_VENICE_S_GAMUT3,
272 WHITEPOINT_NAME_VENICE_S_GAMUT3,
273 MATRIX_VENICE_S_GAMUT3_TO_XYZ,
274 MATRIX_XYZ_TO_VENICE_S_GAMUT3,
275 log_encoding_SLog3,
276 log_decoding_SLog3,
277)
278RGB_COLOURSPACE_VENICE_S_GAMUT3.__doc__ = """
279*Venice S-Gamut3* colourspace.
281References
282----------
283:cite:`SonyElectronicsCorporation2020`
284"""
286PRIMARIES_VENICE_S_GAMUT3_CINE: NDArrayFloat = np.array(
287 [
288 [0.775901871567345, 0.274502392854799],
289 [0.188682902773355, 0.828684937020288],
290 [0.101337382499301, -0.089187517306263],
291 ]
292)
293"""*Venice S-Gamut3.Cine* colourspace primaries."""
295WHITEPOINT_NAME_VENICE_S_GAMUT3_CINE: str = WHITEPOINT_NAME_S_GAMUT
296"""*Venice S-Gamut3.Cine* colourspace whitepoint name."""
298CCS_WHITEPOINT_VENICE_S_GAMUT3_CINE: NDArrayFloat = CCS_WHITEPOINT_S_GAMUT
299"""*Venice S-Gamut3.Cine* colourspace whitepoint chromaticity coordinates."""
301MATRIX_VENICE_S_GAMUT3_CINE_TO_XYZ: NDArrayFloat = normalised_primary_matrix(
302 PRIMARIES_VENICE_S_GAMUT3_CINE, CCS_WHITEPOINT_VENICE_S_GAMUT3_CINE
303)
304"""*Venice S-Gamut3.Cine* colourspace to *CIE XYZ* tristimulus values matrix."""
306MATRIX_XYZ_TO_VENICE_S_GAMUT3_CINE: NDArrayFloat = np.linalg.inv(
307 MATRIX_VENICE_S_GAMUT3_CINE_TO_XYZ
308)
309"""*CIE XYZ* tristimulus values to *Venice S-Gamut3.Cine* colourspace matrix."""
311RGB_COLOURSPACE_VENICE_S_GAMUT3_CINE: RGB_Colourspace = RGB_Colourspace(
312 "Venice S-Gamut3.Cine",
313 PRIMARIES_VENICE_S_GAMUT3_CINE,
314 CCS_WHITEPOINT_VENICE_S_GAMUT3_CINE,
315 WHITEPOINT_NAME_VENICE_S_GAMUT3_CINE,
316 MATRIX_VENICE_S_GAMUT3_CINE_TO_XYZ,
317 MATRIX_XYZ_TO_VENICE_S_GAMUT3_CINE,
318 log_encoding_SLog3,
319 log_decoding_SLog3,
320)
321RGB_COLOURSPACE_VENICE_S_GAMUT3_CINE.__doc__ = """
322*Venice S-Gamut3.Cine* colourspace.
324References
325----------
326:cite:`SonyElectronicsCorporation2020a`
327"""