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

1"""

2 CIE RGB Colourspace

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

4

5 Define the *CIE RGB* colourspace:

6

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

8

9 References

10----------

11- :cite:`Fairman1997` : Fairman, H. S., Brill, M. H., & Hemmendinger, H.

12 (1997). How the CIE 1931 color-matching functions were derived from

13 Wright-Guild data. Color Research & Application, 22(1), 11-23.

14 doi:10.1002/(SICI)1520-6378(199702)22:1<11::AID-COL4>3.0.CO;2-7

15"""

16

17 from __future__ import annotations

18

19 import typing

20 from functools import partial

21

22 import numpy as np

23

24 from colour.colorimetry import CCS_ILLUMINANTS

25

26 if typing.TYPE_CHECKING:

27 from colour.hints import NDArrayFloat

28

29 from colour.models.rgb import RGB_Colourspace, gamma_function

30

31 __author__ = "Colour Developers"

32 __copyright__ = "Copyright 2013 Colour Developers"

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

34 __maintainer__ = "Colour Developers"

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

36 __status__ = "Production"

37

38 __all__ = [

39 "PRIMARIES_CIE_RGB",

40 "WHITEPOINT_NAME_CIE_RGB",

41 "CCS_WHITEPOINT_CIE_RGB",

42 "MATRIX_CIE_RGB_TO_XYZ",

43 "MATRIX_XYZ_TO_CIE_RGB",

44 "RGB_COLOURSPACE_CIE_RGB",

45]

46

47 PRIMARIES_CIE_RGB: NDArrayFloat = np.array(

48 [

49 [0.734742840005998, 0.265257159994002],

50 [0.273779033824958, 0.717477700256116],

51 [0.166555629580280, 0.008910726182545],

52 ]

53)

54"""

55*CIE RGB* colourspace primaries.

56

57 Notes

58-----

59- *CIE RGB* colourspace primaries were computed using

60 :attr:`colour.models.rgb.datasets.cie_rgb.MATRIX_CIE_RGB_TO_XYZ` attribute

61 and :func:`colour.primaries_whitepoint` definition.

62"""

63

64 WHITEPOINT_NAME_CIE_RGB: str = "E"

65"""*CIE RGB* colourspace whitepoint name."""

66

67 CCS_WHITEPOINT_CIE_RGB: NDArrayFloat = CCS_ILLUMINANTS[

68 "CIE 1931 2 Degree Standard Observer"

69][WHITEPOINT_NAME_CIE_RGB]

70"""*CIE RGB* colourspace whitepoint chromaticity coordinates."""

71

72 MATRIX_CIE_RGB_TO_XYZ: NDArrayFloat = np.array(

73 [

74 [0.4900, 0.3100, 0.2000],

75 [0.1769, 0.8124, 0.0107],

76 [0.0000, 0.0099, 0.9901],

77 ]

78)

79"""*CIE RGB* colourspace to *CIE XYZ* tristimulus values matrix."""

80

81 MATRIX_XYZ_TO_CIE_RGB: NDArrayFloat = np.linalg.inv(MATRIX_CIE_RGB_TO_XYZ)

82"""*CIE XYZ* tristimulus values to *CIE RGB* colourspace matrix."""

83

84 RGB_COLOURSPACE_CIE_RGB: RGB_Colourspace = RGB_Colourspace(

85 "CIE RGB",

86 PRIMARIES_CIE_RGB,

87 CCS_WHITEPOINT_CIE_RGB,

88 WHITEPOINT_NAME_CIE_RGB,

89 MATRIX_CIE_RGB_TO_XYZ,

90 MATRIX_XYZ_TO_CIE_RGB,

91 partial(gamma_function, exponent=1 / 2.2),

92 partial(gamma_function, exponent=2.2),

93)

94 RGB_COLOURSPACE_CIE_RGB.__doc__ = """

95*CIE RGB* colourspace.

96

97 References

98----------

99:cite:`Fairman1997`

100"""