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

1"""

2 Recommendation ITU-R BT.470 Colourspaces

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

4

5 Define the *Recommendation ITU-R BT.470* colourspaces:

6

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

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

9

10 References

11----------

12- :cite:`InternationalTelecommunicationUnion1998a` : International

13 Telecommunication Union. (1998). Recommendation ITU-R BT.470-6 -

14 CONVENTIONAL TELEVISION SYSTEMS (pp. 1-36).

15 http://www.itu.int/dms_pubrec/itu-r/rec/bt/\

16 R-REC-BT.470-6-199811-S!!PDF-E.pdf

17"""

18

19 from __future__ import annotations

20

21 import typing

22 from functools import partial

23

24 import numpy as np

25

26 from colour.colorimetry import CCS_ILLUMINANTS

27

28 if typing.TYPE_CHECKING:

29 from colour.hints import NDArrayFloat

30

31 from colour.models.rgb import RGB_Colourspace, gamma_function, normalised_primary_matrix

32

33 __author__ = "Colour Developers"

34 __copyright__ = "Copyright 2013 Colour Developers"

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

36 __maintainer__ = "Colour Developers"

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

38 __status__ = "Production"

39

40 __all__ = [

41 "PRIMARIES_BT470_525",

42 "CCS_WHITEPOINT_BT470_525",

43 "WHITEPOINT_NAME_BT470_525",

44 "MATRIX_BT470_525_TO_XYZ",

45 "MATRIX_XYZ_TO_BT470_525",

46 "RGB_COLOURSPACE_BT470_525",

47 "PRIMARIES_BT470_625",

48 "CCS_WHITEPOINT_BT470_625",

49 "WHITEPOINT_NAME_BT470_625",

50 "MATRIX_BT470_625_TO_XYZ",

51 "MATRIX_XYZ_TO_BT470_625",

52 "RGB_COLOURSPACE_BT470_625",

53]

54

55 PRIMARIES_BT470_525: NDArrayFloat = np.array(

56 [

57 [0.6700, 0.3300],

58 [0.2100, 0.7100],

59 [0.1400, 0.0800],

60 ]

61)

62"""*Recommendation ITU-R BT.470 - 525* colourspace primaries."""

63

64 WHITEPOINT_NAME_BT470_525: str = "C"

65"""*Recommendation ITU-R BT.470 - 525* colourspace whitepoint name."""

66

67 CCS_WHITEPOINT_BT470_525: NDArrayFloat = CCS_ILLUMINANTS[

68 "CIE 1931 2 Degree Standard Observer"

69][WHITEPOINT_NAME_BT470_525]

70"""

71*Recommendation ITU-R BT.470 - 525* colourspace whitepoint chromaticity

72 coordinates.

73"""

74

75 MATRIX_BT470_525_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

76 PRIMARIES_BT470_525, CCS_WHITEPOINT_BT470_525

77)

78"""

79*Recommendation ITU-R BT.470 - 525* colourspace to *CIE XYZ* tristimulus values

80 matrix.

81"""

82

83 MATRIX_XYZ_TO_BT470_525: NDArrayFloat = np.linalg.inv(MATRIX_BT470_525_TO_XYZ)

84"""

85*CIE XYZ* tristimulus values to *Recommendation ITU-R BT.470 - 525* colourspace

86 matrix.

87"""

88

89 RGB_COLOURSPACE_BT470_525: RGB_Colourspace = RGB_Colourspace(

90 "ITU-R BT.470 - 525",

91 PRIMARIES_BT470_525,

92 CCS_WHITEPOINT_BT470_525,

93 WHITEPOINT_NAME_BT470_525,

94 MATRIX_BT470_525_TO_XYZ,

95 MATRIX_XYZ_TO_BT470_525,

96 partial(gamma_function, exponent=1 / 2.8),

97 partial(gamma_function, exponent=2.8),

98)

99 RGB_COLOURSPACE_BT470_525.__doc__ = """

100*Recommendation ITU-R BT.470 - 525* colourspace.

101

102 References

103----------

104:cite:`InternationalTelecommunicationUnion1998a`

105"""

106

107 PRIMARIES_BT470_625: NDArrayFloat = np.array(

108 [

109 [0.6400, 0.3300],

110 [0.2900, 0.6000],

111 [0.1500, 0.0600],

112 ]

113)

114"""*Recommendation ITU-R BT.470 - 625* colourspace primaries."""

115

116 WHITEPOINT_NAME_BT470_625: str = "D65"

117"""*Recommendation ITU-R BT.470 - 625* colourspace whitepoint name."""

118

119 CCS_WHITEPOINT_BT470_625: NDArrayFloat = CCS_ILLUMINANTS[

120 "CIE 1931 2 Degree Standard Observer"

121][WHITEPOINT_NAME_BT470_625]

122"""

123*Recommendation ITU-R BT.470 - 625* colourspace whitepoint chromaticity

124 coordinates.

125"""

126

127 MATRIX_BT470_625_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

128 PRIMARIES_BT470_625, CCS_WHITEPOINT_BT470_625

129)

130"""

131*Recommendation ITU-R BT.470 - 625* colourspace to *CIE XYZ* tristimulus values

132 matrix.

133"""

134

135 MATRIX_XYZ_TO_BT470_625: NDArrayFloat = np.linalg.inv(MATRIX_BT470_625_TO_XYZ)

136"""

137*CIE XYZ* tristimulus values to *Recommendation ITU-R BT.470 - 625* colourspace

138 matrix.

139"""

140

141 RGB_COLOURSPACE_BT470_625: RGB_Colourspace = RGB_Colourspace(

142 "ITU-R BT.470 - 625",

143 PRIMARIES_BT470_625,

144 CCS_WHITEPOINT_BT470_625,

145 WHITEPOINT_NAME_BT470_625,

146 MATRIX_BT470_625_TO_XYZ,

147 MATRIX_XYZ_TO_BT470_625,

148 partial(gamma_function, exponent=1 / 2.8),

149 partial(gamma_function, exponent=2.8),

150)

151 RGB_COLOURSPACE_BT470_625.__doc__ = """

152*Recommendation ITU-R BT.470 - 625* colourspace.

153

154 References

155----------

156:cite:`InternationalTelecommunicationUnion1998a`

157"""