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

1"""

2 Sharp RGB Colourspace

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

4

5 Define the *Sharp RGB* colourspace:

6

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

8

9 References

10----------

11- :cite:`Susstrunk2000` : Susstrunk, S. E., Holm, J. M., & Finlayson, G. D.

12 (2000). Chromatic adaptation performance of different RGB sensors. In R.

13 Eschbach & G. G. Marcu (Eds.), Photonics West 2001 - Electronic Imaging

14 (Vol. 4300, Issue January, pp. 172-183). doi:10.1117/12.410788

15- :cite:`Ward2002` : Ward, G., & Eydelberg-Vileshin, E. (2002). Picture

16 Perfect RGB Rendering Using Spectral Prefiltering and Sharp Color

17 Primaries. Eurographics Workshop on Rendering, 117-124.

18 doi:10.2312/EGWR/EGWR02/117-124

19- :cite:`Ward2016` : Borer, T. (2017). Private Discussion with Mansencal, T.

20 and Shaw, N.

21"""

22

23 from __future__ import annotations

24

25 import typing

26

27 import numpy as np

28

29 from colour.colorimetry import CCS_ILLUMINANTS

30

31 if typing.TYPE_CHECKING:

32 from colour.hints import NDArrayFloat

33

34 from colour.models.rgb import (

35 RGB_Colourspace,

36 linear_function,

37 normalised_primary_matrix,

38)

39

40 __author__ = "Colour Developers"

41 __copyright__ = "Copyright 2013 Colour Developers"

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

43 __maintainer__ = "Colour Developers"

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

45 __status__ = "Production"

46

47 __all__ = [

48 "PRIMARIES_SHARP_RGB",

49 "WHITEPOINT_NAME_SHARP_RGB",

50 "CCS_WHITEPOINT_SHARP_RGB",

51 "MATRIX_SHARP_RGB_TO_XYZ",

52 "MATRIX_XYZ_TO_SHARP_RGB",

53 "RGB_COLOURSPACE_SHARP_RGB",

54]

55

56 PRIMARIES_SHARP_RGB: NDArrayFloat = np.array(

57 [

58 [0.6898, 0.3206],

59 [0.0736, 0.9003],

60 [0.1166, 0.0374],

61 ]

62)

63"""

64*Sharp RGB* colourspace primaries.

65

66 Notes

67-----

68 The primaries were originally derived from the :math:`M_{Sharp}` matrix as

69 specified in *Ward and Eydelberg-Vileshin (2002)*:

70

71 M_Sharp = np.array(

72 [[1.2694, -0.0988, -0.1706],

73 [-0.8364, 1.8006, 0.0357],

74 [0.0297, -0.0315, 1.0018]])

75

76 P, W = (

77 array([[ 0.68976058, 0.32060751],

78 [ 0.07358274, 0.90029055],

79 [ 0.1166078 , 0.0373923 ]]),

80 array([ 0.33332778, 0.33334544]))

81

82 Private discussion with Ward (2016) confirmed he used the following primaries

83 and whitepoint:

84

85 [0.6898, 0.3206, 0.0736, 0.9003, 0.1166, 0.0374, 1 / 3, 1 / 3]

86"""

87

88 WHITEPOINT_NAME_SHARP_RGB: str = "E"

89"""*Sharp RGB* colourspace whitepoint name."""

90

91 CCS_WHITEPOINT_SHARP_RGB: NDArrayFloat = CCS_ILLUMINANTS[

92 "CIE 1931 2 Degree Standard Observer"

93][WHITEPOINT_NAME_SHARP_RGB]

94"""*Sharp RGB* colourspace whitepoint chromaticity coordinates."""

95

96 MATRIX_SHARP_RGB_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

97 PRIMARIES_SHARP_RGB, CCS_WHITEPOINT_SHARP_RGB

98)

99"""*Sharp RGB* colourspace to *CIE XYZ* tristimulus values matrix."""

100

101 MATRIX_XYZ_TO_SHARP_RGB: NDArrayFloat = np.linalg.inv(MATRIX_SHARP_RGB_TO_XYZ)

102"""*CIE XYZ* tristimulus values to *Sharp RGB* colourspace matrix."""

103

104 RGB_COLOURSPACE_SHARP_RGB: RGB_Colourspace = RGB_Colourspace(

105 "Sharp RGB",

106 PRIMARIES_SHARP_RGB,

107 CCS_WHITEPOINT_SHARP_RGB,

108 WHITEPOINT_NAME_SHARP_RGB,

109 MATRIX_SHARP_RGB_TO_XYZ,

110 MATRIX_XYZ_TO_SHARP_RGB,

111 linear_function,

112 linear_function,

113)

114 RGB_COLOURSPACE_SHARP_RGB.__doc__ = """

115*Sharp RGB* colourspace.

116

117 References

118----------

119:cite:`Susstrunk2000`, :cite:`Ward2002`, :cite:`Ward2016`

120"""