Coverage for models/rgb/datasets/red.py: 0%

1"""

2 RED Colourspaces

3================

4

5 Define the *RED* colourspaces:

6

7- :attr:`colour.models.RGB_COLOURSPACE_RED_COLOR`

8- :attr:`colour.models.RGB_COLOURSPACE_RED_COLOR_2`

9- :attr:`colour.models.RGB_COLOURSPACE_RED_COLOR_3`

10- :attr:`colour.models.RGB_COLOURSPACE_RED_COLOR_4`

11- :attr:`colour.models.RGB_COLOURSPACE_DRAGON_COLOR`

12- :attr:`colour.models.RGB_COLOURSPACE_DRAGON_COLOR_2`

13- :attr:`colour.models.RGB_COLOURSPACE_RED_WIDE_GAMUT_RGB`

14

15 References

16----------

17- :cite:`Mansencal2015d` : Mansencal, T. (2015). RED Colourspaces Derivation.

18 Retrieved May 20, 2015, from

19 https://www.colour-science.org/posts/red-colourspaces-derivation

20- :cite:`Nattress2016a` : Nattress, G. (2016). Private Discussion with Shaw,

21 N.

22- :cite:`SonyImageworks2012a` : Sony Imageworks. (2012). make.py. Retrieved

23 November 27, 2014, from

24 https://github.com/imageworks/OpenColorIO-Configs/blob/master/\

25 nuke-default/make.py

26"""

27

28 from __future__ import annotations

29

30 import typing

31

32 import numpy as np

33

34 from colour.colorimetry import CCS_ILLUMINANTS

35

36 if typing.TYPE_CHECKING:

37 from colour.hints import NDArrayFloat

38

39 from colour.models.rgb import (

40 RGB_Colourspace,

41 log_decoding_Log3G10,

42 log_decoding_REDLogFilm,

43 log_encoding_Log3G10,

44 log_encoding_REDLogFilm,

45 normalised_primary_matrix,

46)

47

48 __author__ = "Colour Developers"

49 __copyright__ = "Copyright 2013 Colour Developers"

50 __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"

51 __maintainer__ = "Colour Developers"

52 __email__ = "colour-developers@colour-science.org"

53 __status__ = "Production"

54

55 __all__ = [

56 "PRIMARIES_RED_COLOR",

57 "WHITEPOINT_NAME_RED_COLOR",

58 "CCS_WHITEPOINT_RED_COLOR",

59 "MATRIX_RED_COLOR_TO_XYZ",

60 "MATRIX_XYZ_TO_RED_COLOR",

61 "RGB_COLOURSPACE_RED_COLOR",

62 "PRIMARIES_RED_COLOR_2",

63 "WHITEPOINT_NAME_RED_COLOR_2",

64 "CCS_WHITEPOINT_RED_COLOR_2",

65 "MATRIX_RED_COLOR_2_TO_XYZ",

66 "MATRIX_XYZ_TO_RED_COLOR_2",

67 "RGB_COLOURSPACE_RED_COLOR_2",

68 "PRIMARIES_RED_COLOR_3",

69 "WHITEPOINT_NAME_RED_COLOR_3",

70 "CCS_WHITEPOINT_RED_COLOR_3",

71 "MATRIX_RED_COLOR_3_TO_XYZ",

72 "MATRIX_XYZ_TO_RED_COLOR_3",

73 "RGB_COLOURSPACE_RED_COLOR_3",

74 "PRIMARIES_RED_COLOR_4",

75 "WHITEPOINT_NAME_RED_COLOR_4",

76 "CCS_WHITEPOINT_RED_COLOR_4",

77 "MATRIX_RED_COLOR_4_TO_XYZ",

78 "MATRIX_XYZ_TO_RED_COLOR_4",

79 "RGB_COLOURSPACE_RED_COLOR_4",

80 "PRIMARIES_DRAGON_COLOR",

81 "WHITEPOINT_NAME_DRAGON_COLOR",

82 "CCS_WHITEPOINT_DRAGON_COLOR",

83 "MATRIX_DRAGON_COLOR_TO_XYZ",

84 "MATRIX_XYZ_TO_DRAGON_COLOR",

85 "RGB_COLOURSPACE_DRAGON_COLOR",

86 "PRIMARIES_DRAGON_COLOR_2",

87 "WHITEPOINT_NAME_DRAGON_COLOR_2",

88 "CCS_WHITEPOINT_DRAGON_COLOR_2",

89 "MATRIX_DRAGON_COLOR_2_TO_XYZ",

90 "MATRIX_XYZ_TO_DRAGON_COLOR_2",

91 "RGB_COLOURSPACE_DRAGON_COLOR_2",

92 "PRIMARIES_RED_WIDE_GAMUT_RGB",

93 "WHITEPOINT_NAME_RED_WIDE_GAMUT_RGB",

94 "CCS_WHITEPOINT_RED_WIDE_GAMUT_RGB",

95 "MATRIX_RED_WIDE_GAMUT_RGB_TO_XYZ",

96 "MATRIX_XYZ_TO_RED_WIDE_GAMUT_RGB",

97 "RGB_COLOURSPACE_RED_WIDE_GAMUT_RGB",

98]

99

100 PRIMARIES_RED_COLOR: NDArrayFloat = np.array(

101 [

102 [0.701058563171395, 0.330180975940326],

103 [0.298811317306316, 0.625169245953133],

104 [0.135038675201355, 0.035261776551191],

105 ]

106)

107"""*REDcolor* colourspace primaries."""

108

109 WHITEPOINT_NAME_RED_COLOR: str = "D65"

110"""*REDcolor* colourspace whitepoint name."""

111

112 CCS_WHITEPOINT_RED_COLOR: NDArrayFloat = CCS_ILLUMINANTS[

113 "CIE 1931 2 Degree Standard Observer"

114][WHITEPOINT_NAME_RED_COLOR]

115"""*REDcolor* colourspace whitepoint chromaticity coordinates."""

116

117 MATRIX_RED_COLOR_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

118 PRIMARIES_RED_COLOR, CCS_WHITEPOINT_RED_COLOR

119)

120"""*REDcolor* colourspace to *CIE XYZ* tristimulus values matrix."""

121

122 MATRIX_XYZ_TO_RED_COLOR: NDArrayFloat = np.linalg.inv(MATRIX_RED_COLOR_TO_XYZ)

123"""*CIE XYZ* tristimulus values to *REDcolor* colourspace matrix."""

124

125 RGB_COLOURSPACE_RED_COLOR: RGB_Colourspace = RGB_Colourspace(

126 "REDcolor",

127 PRIMARIES_RED_COLOR,

128 CCS_WHITEPOINT_RED_COLOR,

129 WHITEPOINT_NAME_RED_COLOR,

130 MATRIX_RED_COLOR_TO_XYZ,

131 MATRIX_XYZ_TO_RED_COLOR,

132 log_encoding_REDLogFilm,

133 log_decoding_REDLogFilm,

134)

135 RGB_COLOURSPACE_RED_COLOR.__doc__ = """

136*REDcolor* colourspace.

137

138 References

139----------

140:cite:`Mansencal2015d`, :cite:`SonyImageworks2012a`

141"""

142

143 PRIMARIES_RED_COLOR_2: NDArrayFloat = np.array(

144 [

145 [0.897407221929776, 0.330776225980398],

146 [0.296022094516625, 0.684635550900945],

147 [0.099799512883393, -0.023000513177992],

148 ]

149)

150"""*REDcolor2* colourspace primaries."""

151

152 WHITEPOINT_NAME_RED_COLOR_2: str = WHITEPOINT_NAME_RED_COLOR

153"""*REDcolor2* colourspace whitepoint name."""

154

155 CCS_WHITEPOINT_RED_COLOR_2: NDArrayFloat = CCS_WHITEPOINT_RED_COLOR

156"""*REDcolor2* colourspace whitepoint chromaticity coordinates."""

157

158 MATRIX_RED_COLOR_2_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

159 PRIMARIES_RED_COLOR_2, CCS_WHITEPOINT_RED_COLOR_2

160)

161"""*REDcolor2* colourspace to *CIE XYZ* tristimulus values matrix."""

162

163 MATRIX_XYZ_TO_RED_COLOR_2: NDArrayFloat = np.linalg.inv(MATRIX_RED_COLOR_2_TO_XYZ)

164"""*CIE XYZ* tristimulus values to *REDcolor2* colourspace matrix."""

165

166 RGB_COLOURSPACE_RED_COLOR_2: RGB_Colourspace = RGB_Colourspace(

167 "REDcolor2",

168 PRIMARIES_RED_COLOR_2,

169 CCS_WHITEPOINT_RED_COLOR_2,

170 WHITEPOINT_NAME_RED_COLOR_2,

171 MATRIX_RED_COLOR_2_TO_XYZ,

172 MATRIX_XYZ_TO_RED_COLOR_2,

173 log_encoding_REDLogFilm,

174 log_decoding_REDLogFilm,

175)

176 RGB_COLOURSPACE_RED_COLOR_2.__doc__ = """

177*REDcolor2* colourspace.

178

179 References

180----------

181:cite:`Mansencal2015d`, :cite:`SonyImageworks2012a`

182"""

183

184 PRIMARIES_RED_COLOR_3: NDArrayFloat = np.array(

185 [

186 [0.702598658589917, 0.330185588938484],

187 [0.295782235737268, 0.689748258397534],

188 [0.111090529079787, -0.004332320984771],

189 ]

190)

191"""*REDcolor3* colourspace primaries."""

192

193 WHITEPOINT_NAME_RED_COLOR_3: str = WHITEPOINT_NAME_RED_COLOR

194"""*REDcolor3* colourspace whitepoint name."""

195

196 CCS_WHITEPOINT_RED_COLOR_3: NDArrayFloat = CCS_WHITEPOINT_RED_COLOR

197"""*REDcolor3* colourspace whitepoint chromaticity coordinates."""

198

199 MATRIX_RED_COLOR_3_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

200 PRIMARIES_RED_COLOR_3, CCS_WHITEPOINT_RED_COLOR_3

201)

202"""*REDcolor3* colourspace to *CIE XYZ* tristimulus values matrix."""

203

204 MATRIX_XYZ_TO_RED_COLOR_3: NDArrayFloat = np.linalg.inv(MATRIX_RED_COLOR_3_TO_XYZ)

205"""*CIE XYZ* tristimulus values to *REDcolor3* colourspace matrix."""

206

207 RGB_COLOURSPACE_RED_COLOR_3: RGB_Colourspace = RGB_Colourspace(

208 "REDcolor3",

209 PRIMARIES_RED_COLOR_3,

210 CCS_WHITEPOINT_RED_COLOR_3,

211 WHITEPOINT_NAME_RED_COLOR_3,

212 MATRIX_RED_COLOR_3_TO_XYZ,

213 MATRIX_XYZ_TO_RED_COLOR_3,

214 log_encoding_REDLogFilm,

215 log_decoding_REDLogFilm,

216)

217 RGB_COLOURSPACE_RED_COLOR_3.__doc__ = """

218*REDcolor3* colourspace.

219

220 References

221----------

222:cite:`Mansencal2015d`, :cite:`SonyImageworks2012a`

223"""

224

225 PRIMARIES_RED_COLOR_4: NDArrayFloat = np.array(

226 [

227 [0.702598154635438, 0.330185096210515],

228 [0.295782328047083, 0.689748253964859],

229 [0.144459236489795, 0.050837720977386],

230 ]

231)

232"""*REDcolor4* colourspace primaries."""

233

234 WHITEPOINT_NAME_RED_COLOR_4: str = WHITEPOINT_NAME_RED_COLOR

235"""*REDcolor4* colourspace whitepoint name."""

236

237 CCS_WHITEPOINT_RED_COLOR_4: NDArrayFloat = CCS_WHITEPOINT_RED_COLOR

238"""*REDcolor4* colourspace whitepoint chromaticity coordinates."""

239

240 MATRIX_RED_COLOR_4_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

241 PRIMARIES_RED_COLOR_4, CCS_WHITEPOINT_RED_COLOR_4

242)

243"""*REDcolor4* colourspace to *CIE XYZ* tristimulus values matrix."""

244

245 MATRIX_XYZ_TO_RED_COLOR_4: NDArrayFloat = np.linalg.inv(MATRIX_RED_COLOR_4_TO_XYZ)

246"""*CIE XYZ* tristimulus values to *REDcolor4* colourspace matrix."""

247

248 RGB_COLOURSPACE_RED_COLOR_4: RGB_Colourspace = RGB_Colourspace(

249 "REDcolor4",

250 PRIMARIES_RED_COLOR_4,

251 CCS_WHITEPOINT_RED_COLOR_4,

252 WHITEPOINT_NAME_RED_COLOR_4,

253 MATRIX_RED_COLOR_4_TO_XYZ,

254 MATRIX_XYZ_TO_RED_COLOR_4,

255 log_encoding_REDLogFilm,

256 log_decoding_REDLogFilm,

257)

258 RGB_COLOURSPACE_RED_COLOR_4.__doc__ = """

259*REDcolor4* colourspace.

260

261 References

262----------

263:cite:`Mansencal2015d`, :cite:`SonyImageworks2012a`

264"""

265

266 PRIMARIES_DRAGON_COLOR: NDArrayFloat = np.array(

267 [

268 [0.758655892599321, 0.330355348611293],

269 [0.294923619810175, 0.708053242065117],

270 [0.085961601167585, -0.045879436983969],

271 ]

272)

273"""*DRAGONcolor* colourspace primaries."""

274

275 WHITEPOINT_NAME_DRAGON_COLOR: str = WHITEPOINT_NAME_RED_COLOR

276"""*DRAGONcolor* colourspace whitepoint name."""

277

278 CCS_WHITEPOINT_DRAGON_COLOR: NDArrayFloat = CCS_WHITEPOINT_RED_COLOR

279"""*DRAGONcolor* colourspace whitepoint chromaticity coordinates."""

280

281 MATRIX_DRAGON_COLOR_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

282 PRIMARIES_DRAGON_COLOR, CCS_WHITEPOINT_DRAGON_COLOR

283)

284"""*DRAGONcolor* colourspace to *CIE XYZ* tristimulus values matrix."""

285

286 MATRIX_XYZ_TO_DRAGON_COLOR: NDArrayFloat = np.linalg.inv(MATRIX_DRAGON_COLOR_TO_XYZ)

287"""*CIE XYZ* tristimulus values to *DRAGONcolor* colourspace matrix."""

288

289 RGB_COLOURSPACE_DRAGON_COLOR: RGB_Colourspace = RGB_Colourspace(

290 "DRAGONcolor",

291 PRIMARIES_DRAGON_COLOR,

292 CCS_WHITEPOINT_DRAGON_COLOR,

293 WHITEPOINT_NAME_DRAGON_COLOR,

294 MATRIX_DRAGON_COLOR_TO_XYZ,

295 MATRIX_XYZ_TO_DRAGON_COLOR,

296 log_encoding_REDLogFilm,

297 log_decoding_REDLogFilm,

298)

299 RGB_COLOURSPACE_DRAGON_COLOR.__doc__ = """

300*DRAGONcolor* colourspace.

301

302 References

303----------

304:cite:`Mansencal2015d`, :cite:`SonyImageworks2012a`

305"""

306

307 PRIMARIES_DRAGON_COLOR_2: NDArrayFloat = np.array(

308 [

309 [0.758656214177604, 0.330355835762678],

310 [0.294923887732982, 0.708053363192126],

311 [0.144168726866337, 0.050357384587121],

312 ]

313)

314"""*DRAGONcolor2* colourspace primaries."""

315

316 WHITEPOINT_NAME_DRAGON_COLOR_2: str = WHITEPOINT_NAME_RED_COLOR

317"""*DRAGONcolor2* colourspace whitepoint name."""

318

319 CCS_WHITEPOINT_DRAGON_COLOR_2: NDArrayFloat = CCS_WHITEPOINT_RED_COLOR

320"""*DRAGONcolor2* colourspace whitepoint chromaticity coordinates."""

321

322 MATRIX_DRAGON_COLOR_2_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

323 PRIMARIES_DRAGON_COLOR_2, CCS_WHITEPOINT_DRAGON_COLOR_2

324)

325"""*DRAGONcolor2* colourspace to *CIE XYZ* tristimulus values matrix."""

326

327 MATRIX_XYZ_TO_DRAGON_COLOR_2: NDArrayFloat = np.linalg.inv(MATRIX_DRAGON_COLOR_2_TO_XYZ)

328"""*CIE XYZ* tristimulus values to *DRAGONcolor2* colourspace matrix."""

329

330 RGB_COLOURSPACE_DRAGON_COLOR_2: RGB_Colourspace = RGB_Colourspace(

331 "DRAGONcolor2",

332 PRIMARIES_DRAGON_COLOR_2,

333 CCS_WHITEPOINT_DRAGON_COLOR_2,

334 WHITEPOINT_NAME_DRAGON_COLOR_2,

335 MATRIX_DRAGON_COLOR_2_TO_XYZ,

336 MATRIX_XYZ_TO_DRAGON_COLOR_2,

337 log_encoding_REDLogFilm,

338 log_decoding_REDLogFilm,

339)

340 RGB_COLOURSPACE_DRAGON_COLOR_2.__doc__ = """

341*DRAGONcolor2* colourspace.

342

343 References

344----------

345:cite:`Mansencal2015d`, :cite:`SonyImageworks2012a`

346"""

347

348 PRIMARIES_RED_WIDE_GAMUT_RGB: NDArrayFloat = np.array(

349 [

350 [0.780308, 0.304253],

351 [0.121595, 1.493994],

352 [0.095612, -0.084589],

353 ]

354)

355"""*REDWideGamutRGB* colourspace primaries."""

356

357 WHITEPOINT_NAME_RED_WIDE_GAMUT_RGB: str = WHITEPOINT_NAME_RED_COLOR

358"""*REDWideGamutRGB* colourspace whitepoint name."""

359

360 CCS_WHITEPOINT_RED_WIDE_GAMUT_RGB = CCS_WHITEPOINT_RED_COLOR

361"""*REDWideGamutRGB* colourspace whitepoint chromaticity coordinates."""

362

363 MATRIX_RED_WIDE_GAMUT_RGB_TO_XYZ: NDArrayFloat = np.array(

364 [

365 [0.735275, 0.068609, 0.146571],

366 [0.286694, 0.842979, -0.129673],

367 [-0.079681, -0.347343, 1.516082],

368 ]

369)

370"""*REDWideGamutRGB* colourspace to *CIE XYZ* tristimulus values matrix."""

371

372 MATRIX_XYZ_TO_RED_WIDE_GAMUT_RGB: NDArrayFloat = np.linalg.inv(

373 MATRIX_RED_WIDE_GAMUT_RGB_TO_XYZ

374)

375"""*CIE XYZ* tristimulus values to *REDWideGamutRGB* colourspace matrix."""

376

377 RGB_COLOURSPACE_RED_WIDE_GAMUT_RGB: RGB_Colourspace = RGB_Colourspace(

378 "REDWideGamutRGB",

379 PRIMARIES_RED_WIDE_GAMUT_RGB,

380 CCS_WHITEPOINT_RED_WIDE_GAMUT_RGB,

381 WHITEPOINT_NAME_RED_WIDE_GAMUT_RGB,

382 MATRIX_RED_WIDE_GAMUT_RGB_TO_XYZ,

383 MATRIX_XYZ_TO_RED_WIDE_GAMUT_RGB,

384 log_encoding_Log3G10,

385 log_decoding_Log3G10,

386)

387 RGB_COLOURSPACE_RED_WIDE_GAMUT_RGB.__doc__ = """

388*REDWideGamutRGB* colourspace.

389

390 References

391----------

392:cite:`Mansencal2015d`, :cite:`Nattress2016a`, :cite:`SonyImageworks2012a`

393"""