colour.models Package

Sub-Packages

Module Contents

class colour.models.RGB_Colourspace(name, primaries, whitepoint, to_XYZ=None, to_RGB=None, transfer_function=None, inverse_transfer_function=None)

Bases: object

Implements support for the RGB colourspaces dataset from colour.models.dataset.aces_rgb, etc....

Parameters:
  • name (str or unicode) – RGB Colourspace name.
  • primaries (array_like) – RGB Colourspace primaries.
  • whitepoint (array_like) – RGB Colourspace whitepoint.
  • to_XYZ (array_like) – Transformation matrix from colourspace to CIE XYZ colourspace.
  • to_RGB (array_like) – Transformation matrix from CIE XYZ colourspace to colourspace.
  • transfer_function (object) – RGB Colourspace transfer function from linear to colourspace.
  • inverse_transfer_function (object) – RGB Colourspace inverse transfer function from colourspace to linear.
inverse_transfer_function

Property for self.__inverse_transfer_function private attribute.

Returns:self.__inverse_transfer_function.
Return type:object
name

Property for self.__name private attribute.

Returns:self.__name.
Return type:str or unicode
primaries

Property for self.__primaries private attribute.

Returns:self.__primaries.
Return type:array_like, (3, 2)
to_RGB

Property for self.__to_RGB private attribute.

Returns:self.__to_RGB.
Return type:array_like, (3, 3)
to_XYZ

Property for self.__to_XYZ private attribute.

Returns:self.__to_XYZ.
Return type:array_like, (3, 3)
transfer_function

Property for self.__transfer_function private attribute.

Returns:self.__transfer_function.
Return type:object
whitepoint

Property for self.__whitepoint private attribute.

Returns:self.__whitepoint.
Return type:array_like
colour.models.normalised_primary_matrix(primaries, whitepoint)

Returns the normalised primary matrix using given primaries and whitepoint matrices.

Parameters:
  • primaries (array_like) – Primaries chromaticity coordinate matrix, (3, 2).
  • whitepoint (array_like) – Illuminant / whitepoint chromaticity coordinates.
Returns:

Normalised primary matrix.

Return type:

ndarray, (3, 3)

References

[3]RP 177-1993 SMPTE RECOMMENDED PRACTICE - Television Color Equations: 3.3.2 - 3.3.6, DOI: https://doi.org/10.5594/S9781614821915

Examples

>>> pms = np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700])
>>> whitepoint = (0.32168, 0.33767)
>>> normalised_primary_matrix(pms, whitepoint)  
array([[  9.5255239...e-01,   0.0000000...e+00,   9.3678631...e-05],
       [  3.4396645...e-01,   7.2816609...e-01,  -7.2132546...e-02],
       [  0.0000000...e+00,   0.0000000...e+00,   1.0088251...e+00]])
colour.models.RGB_luminance_equation(primaries, whitepoint)

Returns the luminance equation from given primaries and whitepoint matrices.

Parameters:
  • primaries (array_like, (3, 2)) – Primaries chromaticity coordinate matrix.
  • whitepoint (array_like) – Illuminant / whitepoint chromaticity coordinates.
Returns:

Luminance equation.

Return type:

unicode

References

[4]RP 177-1993 SMPTE RECOMMENDED PRACTICE - Television Color Equations: 3.3.8, DOI: https://doi.org/10.5594/S9781614821915

Examples

>>> pms = np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700])
>>> whitepoint = (0.32168, 0.33767)
>>> # Doctests skip for Python 2.x compatibility.
>>> RGB_luminance_equation(pms, whitepoint)  
'Y = 0.3439664...(R) + 0.7281660...(G) + -0.0721325...(B)'
colour.models.RGB_luminance(RGB, primaries, whitepoint)

Returns the luminance \(y\) of given RGB components from given primaries and whitepoint matrices.

Parameters:
  • RGB (array_like, (3,)) – RGB chromaticity coordinate matrix.
  • primaries (array_like, (3, 2)) – Primaries chromaticity coordinate matrix.
  • whitepoint (array_like) – Illuminant / whitepoint chromaticity coordinates.
Returns:

Luminance \(y\).

Return type:

numeric

References

[5]RP 177-1993 SMPTE RECOMMENDED PRACTICE - Television Color Equations: 3.3.3 - 3.3.6, DOI: https://doi.org/10.5594/S9781614821915

Examples

>>> RGB = np.array([40.6, 4.2, 67.4])
>>> pms = np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700])
>>> whitepoint = (0.32168, 0.33767)
>>> RGB_luminance(RGB, pms, whitepoint)  
12.1616018...
colour.models.XYZ_to_xyY(XYZ, illuminant=(0.34567, 0.3585))

Converts from CIE XYZ colourspace to CIE xyY colourspace and reference illuminant.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
  • illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.
Returns:

CIE xyY colourspace matrix.

Return type:

ndarray, (3,)

Notes

  • Input CIE XYZ colourspace matrix is in domain [0, 1].
  • Output CIE xyY colourspace matrix is in domain [0, 1].

References

[2]http://www.brucelindbloom.com/Eqn_XYZ_to_xyY.html (Last accessed 24 February 2014)

Examples

>>> XYZ_to_xyY(np.array([0.1180583421, 0.1034, 0.0515089229]))
array([ 0.4325,  0.3788,  0.1034])
colour.models.xyY_to_XYZ(xyY)

Converts from CIE xyY colourspace to CIE XYZ colourspace.

Parameters:xyY (array_like, (3,)) – CIE xyY colourspace matrix.
Returns:CIE XYZ colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Input CIE xyY colourspace matrix is in domain [0, 1].
  • Output CIE XYZ colourspace matrix is in domain [0, 1].

References

[3]http://www.brucelindbloom.com/Eqn_xyY_to_XYZ.html (Last accessed 24 February 2014)

Examples

>>> xyY_to_XYZ(np.array([0.4325, 0.3788, 0.1034]))  
array([ 0.1180583...,  0.1034    ,  0.0515089...])
colour.models.xy_to_XYZ(xy)

Returns the CIE XYZ colourspace matrix from given xy chromaticity coordinates.

Parameters:xy (array_like) – xy chromaticity coordinates.
Returns:CIE XYZ colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Input xy chromaticity coordinates are in domain [0, 1].
  • Output CIE XYZ colourspace matrix is in domain [0, 1].

Examples

>>> xy_to_XYZ((0.25, 0.25))
array([ 1.,  1.,  2.])
colour.models.XYZ_to_xy(XYZ, illuminant=(0.34567, 0.3585))

Returns the xy chromaticity coordinates from given CIE XYZ colourspace matrix.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
  • illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.
Returns:

xy chromaticity coordinates.

Return type:

tuple

Notes

  • Input CIE XYZ colourspace matrix is in domain [0, 1].
  • Output xy chromaticity coordinates are in domain [0, 1].

Examples

>>> XYZ_to_xy(np.array([0.97137399, 1, 1.04462134]))  
(0.3220741..., 0.3315655...)
>>> XYZ_to_xy((0.97137399, 1, 1.04462134))  
(0.3220741..., 0.3315655...)
colour.models.XYZ_to_Lab(XYZ, illuminant=(0.34567, 0.3585))

Converts from CIE XYZ colourspace to CIE Lab colourspace.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
  • illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.
Returns:

CIE Lab colourspace matrix.

Return type:

ndarray, (3,)

Notes

  • Input CIE XYZ is in domain [0, 1].
  • Input illuminant chromaticity coordinates are in domain [0, 1].
  • Output Lightness \(L^*\) is in domain [0, 100].

References

[2]http://www.brucelindbloom.com/Eqn_XYZ_to_Lab.html (Last accessed 24 February 2014)

Examples

>>> XYZ_to_Lab(np.array([0.92193107, 1, 1.03744246]))  
array([ 100.        ,   -7.4178784...,  -15.8574210...])
colour.models.Lab_to_XYZ(Lab, illuminant=(0.34567, 0.3585))

Converts from CIE Lab colourspace to CIE XYZ colourspace.

Parameters:
  • Lab (array_like, (3,)) – CIE Lab colourspace matrix.
  • illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.
Returns:

CIE XYZ colourspace matrix.

Return type:

ndarray, (3,)

Notes

  • Input Lightness \(L^*\) is in domain [0, 100].
  • Input illuminant chromaticity coordinates are in domain [0, 1].
  • Output CIE XYZ colourspace matrix is in domain [0, 1].

References

[3]http://www.brucelindbloom.com/Eqn_Lab_to_XYZ.html (Last accessed 24 February 2014)

Examples

>>> Lab = np.array([100, -7.41787844, -15.85742105])
>>> Lab_to_XYZ(Lab)  
array([ 0.9219310...,  1.        ,  1.0374424...])
colour.models.Lab_to_LCHab(Lab)

Converts from CIE Lab colourspace to CIE LCHab colourspace.

Parameters:Lab (array_like, (3,)) – CIE Lab colourspace matrix.
Returns:CIE LCHab colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Lightness \(L^*\) is in domain [0, 100].

References

[4]http://www.brucelindbloom.com/Eqn_Lab_to_LCH.html (Last accessed 24 February 2014)

Examples

>>> Lab = np.array([100, -7.41787844, -15.85742105])
>>> Lab_to_LCHab(Lab)  
array([ 100.        ,   17.5066479...,  244.9304684...])
colour.models.LCHab_to_Lab(LCHab)

Converts from CIE LCHab colourspace to CIE Lab colourspace.

Parameters:LCHab (array_like, (3,)) – CIE LCHab colourspace matrix.
Returns:CIE Lab colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Lightness \(L^*\) is in domain [0, 100].

References

[5]http://www.brucelindbloom.com/Eqn_LCH_to_Lab.html (Last accessed 24 February 2014)

Examples

>>> LCHab = np.array([100, 17.50664796, 244.93046842])
>>> LCHab_to_Lab(LCHab)  
array([ 100.        ,   -7.4178784...,  -15.8574210...])
colour.models.XYZ_to_Luv(XYZ, illuminant=(0.34567, 0.3585))

Converts from CIE XYZ colourspace to CIE Luv colourspace.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
  • illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.
Returns:

CIE Luv colourspace matrix.

Return type:

ndarray, (3,)

Notes

  • Input CIE XYZ colourspace matrix is in domain [0, 1].
  • Input illuminant chromaticity coordinates are in domain [0, 1].
  • Output \(L^*\) is in domain [0, 100].

References

[2]http://brucelindbloom.com/Eqn_XYZ_to_Luv.html (Last accessed 24 February 2014)

Examples

>>> XYZ_to_Luv(np.array([0.92193107, 1, 1.03744246]))  
array([ 100.        ,  -20.0430424...,  -19.8167603...])
colour.models.Luv_to_XYZ(Luv, illuminant=(0.34567, 0.3585))

Converts from CIE Luv colourspace to CIE XYZ colourspace.

Parameters:
  • Luv (array_like, (3,)) – CIE Luv colourspace matrix.
  • illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.
Returns:

CIE XYZ colourspace matrix.

Return type:

ndarray, (3,)

Notes

  • Input \(L^*\) is in domain [0, 100].
  • Input illuminant chromaticity coordinates are in domain [0, 1].
  • Output CIE XYZ colourspace matrix is in domain [0, 1].

References

[3]http://brucelindbloom.com/Eqn_Luv_to_XYZ.html (Last accessed 24 February 2014)

Examples

>>> Luv = np.array([100, -20.04304247, -19.81676035])
>>> Luv_to_XYZ(Luv)  
array([ 0.9219310...,  1.        ,  1.0374424...])
colour.models.Luv_to_uv(Luv, illuminant=(0.34567, 0.3585))

Returns the u”v” chromaticity coordinates from given CIE Luv colourspace matrix.

Parameters:
  • Luv (array_like, (3,)) – CIE Luv colourspace matrix.
  • illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.
Returns:

u”v” chromaticity coordinates.

Return type:

tuple

Notes

  • Input \(L^*\) is in domain [0, 100].
  • Output u”v” chromaticity coordinates are in domain [0, 1].

References

[4]http://en.wikipedia.org/wiki/CIELUV#The_forward_transformation (Last accessed 24 February 2014)

Examples

>>> Luv = np.array([100, -20.04304247, -19.81676035])
>>> Luv_to_uv(Luv)  
(0.1937414..., 0.4728316...)
colour.models.Luv_uv_to_xy(uv)

Returns the xy chromaticity coordinates from given CIE Luv colourspace u”v” chromaticity coordinates.

Parameters:uv (array_like) – CIE Luv u”v” chromaticity coordinates.
Returns:xy chromaticity coordinates.
Return type:tuple

Notes

  • Input u”v” chromaticity coordinates are in domain [0, 1].
  • Output xy is in domain [0, 1].

References

[5]http://en.wikipedia.org/wiki/CIELUV#The_reverse_transformation (Last accessed 24 February 2014)

Examples

>>> uv = (0.2033733344733139, 0.3140500001549052)
>>> Luv_uv_to_xy(uv)  
(0.2233388..., 0.1532803...)
colour.models.Luv_to_LCHuv(Luv)

Converts from CIE Luv colourspace to CIE LCHuv colourspace.

Parameters:Luv (array_like, (3,)) – CIE Luv colourspace matrix.
Returns:CIE LCHuv colourspace matrix.
Return type:ndarray, (3,)

Notes

  • \(L^*\) is in domain [0, 100].

References

[6]http://www.brucelindbloom.com/Eqn_Luv_to_LCH.html (Last accessed 24 February 2014)

Examples

>>> Luv = np.array([100, -20.04304247, -19.81676035])
>>> Luv_to_LCHuv(Luv)  
array([ 100.        ,   28.1855910...,  224.6747382...])
colour.models.LCHuv_to_Luv(LCHuv)

Converts from CIE LCHuv colourspace to CIE Luv colourspace.

Parameters:LCHuv (array_like, (3,)) – CIE LCHuv colourspace matrix.
Returns:CIE Luv colourspace matrix.
Return type:ndarray, (3,)

Notes

  • \(L^*\) is in domain [0, 100].

References

[7]http://www.brucelindbloom.com/Eqn_LCH_to_Luv.html (Last accessed 24 February 2014)

Examples

>>> LCHuv = np.array([100, 28.18559104, 224.6747382])
>>> LCHuv_to_Luv(LCHuv)  
array([ 100.        ,  -20.0430424...,  -19.8167603...])
colour.models.XYZ_to_UCS(XYZ)

Converts from CIE XYZ colourspace to CIE UCS colourspace.

Parameters:XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
Returns:CIE UCS colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Input CIE XYZ colourspace matrix is in domain [0, 1].
  • Output CIE UCS colourspace matrix is in domain [0, 1].

References

[2]http://en.wikipedia.org/wiki/CIE_1960_color_space#Relation_to_CIEXYZ (Last accessed 24 February 2014)

Examples

>>> XYZ = np.array([0.1180583421, 0.1034, 0.0515089229])
>>> XYZ_to_UCS(XYZ)  
array([ 0.0787055...,  0.1034    ,  0.1218252...])
colour.models.UCS_to_XYZ(UVW)

Converts from CIE UCS colourspace to CIE XYZ colourspace.

Parameters:UVW (array_like, (3,)) – CIE UCS colourspace matrix.
Returns:CIE XYZ colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Input CIE UCS colourspace matrix is in domain [0, 1].
  • Output CIE XYZ colourspace matrix is in domain [0, 1].

References

[3]http://en.wikipedia.org/wiki/CIE_1960_color_space#Relation_to_CIEXYZ (Last accessed 24 February 2014)

Examples

>>> UCS = np.array([0.07870556, 0.1034, 0.12182529])
>>> UCS_to_XYZ(UCS)  
array([ 0.1180583...,  0.1034    ,  0.0515089...])
colour.models.UCS_to_uv(UVW)

Returns the uv chromaticity coordinates from given CIE UCS colourspace matrix.

Parameters:UVW (array_like, (3,)) – CIE UCS colourspace matrix.
Returns:uv chromaticity coordinates.
Return type:tuple

Notes

  • Input CIE UCS colourspace matrix is in domain [0, 1].
  • Output uv chromaticity coordinates are in domain [0, 1].

References

[4]http://en.wikipedia.org/wiki/CIE_1960_color_space#Relation_to_CIEXYZ (Last accessed 24 February 2014)

Examples

>>> UCS = np.array([0.1180583421, 0.1034, 0.0515089229])
>>> UCS_to_uv(UCS)  
(0.4324999..., 0.3788000...)
colour.models.UCS_uv_to_xy(uv)

Returns the xy chromaticity coordinates from given CIE UCS colourspace uv chromaticity coordinates.

Parameters:uv (array_like) – CIE UCS uv chromaticity coordinates.
Returns:xy chromaticity coordinates.
Return type:tuple

Notes

  • Input uv chromaticity coordinates are in domain [0, 1].
  • Output xy chromaticity coordinates are in domain [0, 1].

References

[5]http://en.wikipedia.org/wiki/CIE_1960_color_space#Relation_to_CIEXYZ (Last accessed 24 February 2014)

Examples

>>> uv = (0.43249999995420696, 0.378800000065942)
>>> UCS_uv_to_xy(uv)  
(0.7072386..., 0.4129510...)
colour.models.XYZ_to_UVW(XYZ, illuminant=(0.34567, 0.3585))

Converts from CIE XYZ colourspace to CIE 1964 U*VW** colourspace.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
  • illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.
Returns:

CIE 1964 U*VW** colourspace matrix.

Return type:

ndarray, (3,)

Notes

  • Input CIE XYZ colourspace matrix is in domain [0, 100].
  • Output CIE UVW colourspace matrix is in domain [0, 100].

Warning

The input / output domains of that definition are non standard!

Examples

>>> XYZ = np.array([11.80583421, 10.34, 5.15089229])
>>> XYZ_to_UVW(XYZ)  
array([ 24.2543371...,   7.2205484...,  37.4645000...])
colour.models.XYZ_to_RGB(XYZ, illuminant_XYZ, illuminant_RGB, to_RGB, chromatic_adaptation_method=u'CAT02', transfer_function=None)

Converts from CIE XYZ colourspace to RGB colourspace using given CIE XYZ colourspace matrix, illuminants, chromatic adaptation method, normalised primary matrix and transfer function.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
  • illuminant_XYZ (array_like) – CIE XYZ colourspace illuminant xy chromaticity coordinates.
  • illuminant_RGB (array_like) – RGB colourspace illuminant xy chromaticity coordinates.
  • to_RGB (array_like, (3, 3)) – Normalised primary matrix.
  • chromatic_adaptation_method (unicode, optional) – (‘XYZ Scaling’, ‘Bradford’, ‘Von Kries’, ‘Fairchild’, ‘CAT02’) Chromatic adaptation method.
  • transfer_function (object, optional) – Transfer function.
Returns:

RGB colourspace matrix.

Return type:

ndarray, (3,)

Notes

  • Input CIE XYZ colourspace matrix is in domain [0, 1].
  • Input illuminant_XYZ xy chromaticity coordinates are in domain [0, 1].
  • Input illuminant_RGB xy chromaticity coordinates are in domain [0, 1].
  • Output RGB colourspace matrix is in domain [0, 1].

Examples

>>> XYZ = np.array([0.1151847498, 0.1008, 0.0508937252])
>>> illuminant_XYZ = (0.34567, 0.35850)
>>> illuminant_RGB = (0.31271, 0.32902)
>>> chromatic_adaptation_method =  'Bradford'
>>> to_RGB = np.array([
...     [3.24100326, -1.53739899, -0.49861587],
...     [-0.96922426, 1.87592999, 0.04155422],
...     [0.05563942, -0.2040112, 1.05714897]])
>>> XYZ_to_RGB(
...     XYZ,
...     illuminant_XYZ,
...     illuminant_RGB,
...     to_RGB,
...     chromatic_adaptation_method)  
array([ 0.1730350...,  0.0821103...,  0.0567249...])
colour.models.RGB_to_XYZ(RGB, illuminant_RGB, illuminant_XYZ, to_XYZ, chromatic_adaptation_method=u'CAT02', inverse_transfer_function=None)

Converts from RGB colourspace to CIE XYZ colourspace using given RGB colourspace matrix, illuminants, chromatic adaptation method, normalised primary matrix and transfer function.

Parameters:
  • RGB (array_like, (3,)) – RGB colourspace matrix.
  • illuminant_RGB (array_like) – RGB colourspace illuminant chromaticity coordinates.
  • illuminant_XYZ (array_like) – CIE XYZ colourspace illuminant chromaticity coordinates.
  • to_XYZ (array_like, (3, 3)) – Normalised primary matrix.
  • chromatic_adaptation_method (unicode, optional) – (‘XYZ Scaling’, ‘Bradford’, ‘Von Kries’, ‘Fairchild’, ‘CAT02’) Chromatic adaptation method.
  • inverse_transfer_function (object, optional) – Inverse transfer function.
Returns:

CIE XYZ colourspace matrix.

Return type:

ndarray, (3,)

Notes

  • Input RGB colourspace matrix is in domain [0, 1].
  • Input illuminant_RGB xy chromaticity coordinates are in domain [0, 1].
  • Input illuminant_XYZ xy chromaticity coordinates are in domain [0, 1].
  • Output CIE XYZ colourspace matrix is in domain [0, 1].

Examples

>>> RGB = np.array([0.17303501, 0.08211033, 0.05672498])
>>> illuminant_RGB = (0.31271, 0.32902)
>>> illuminant_XYZ = (0.34567, 0.35850)
>>> chromatic_adaptation_method = 'Bradford'
>>> to_XYZ = np.array([
...     [0.41238656, 0.35759149, 0.18045049],
...     [0.21263682, 0.71518298, 0.0721802],
...     [0.01933062, 0.11919716, 0.95037259]])
>>> RGB_to_XYZ(
...     RGB,
...     illuminant_RGB,
...     illuminant_XYZ,
...     to_XYZ,
...     chromatic_adaptation_method)  
array([ 0.1151847...,  0.1008    ,  0.0508937...])
colour.models.RGB_to_RGB(RGB, input_colourspace, output_colourspace, chromatic_adaptation_method=u'CAT02')

Converts from given input RGB colourspace to output RGB colourspace using given chromatic adaptation method.

Parameters:
  • RGB (array_like, (3,)) – RGB colourspace matrix.
  • input_colourspace (RGB_Colourspace) – RGB input colourspace.
  • output_colourspace (RGB_Colourspace) – RGB output colourspace.
  • chromatic_adaptation_method (unicode, optional) – (‘XYZ Scaling’, ‘Bradford’, ‘Von Kries’, ‘Fairchild’, ‘CAT02’) Chromatic adaptation method.
  • (3,) (ndarray,) – RGB colourspace matrix.

Notes

  • RGB colourspace matrices are in domain [0, 1].

Examples

>>> from colour import sRGB_COLOURSPACE, PROPHOTO_RGB_COLOURSPACE
>>> RGB = np.array([0.35521588, 0.41, 0.24177934])
>>> RGB_to_RGB(
...     RGB,
...     sRGB_COLOURSPACE,
...     PROPHOTO_RGB_COLOURSPACE)  
array([ 0.3579334...,  0.4007138...,  0.2615704...])
colour.models.XYZ_to_sRGB(XYZ, illuminant=(0.31271, 0.32902), chromatic_adaptation_method=u'CAT02', transfer_function=True)

Converts from CIE XYZ colourspace to sRGB colourspace.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
  • illuminant (array_like, optional) – Source illuminant chromaticity coordinates.
  • chromatic_adaptation_method (unicode, optional) – (‘XYZ Scaling’, ‘Bradford’, ‘Von Kries’, ‘Fairchild’, ‘CAT02’) Chromatic adaptation method.
  • transfer_function (bool, optional) – Apply sRGB transfer function.
Returns:

sRGB colour matrix.

Return type:

ndarray, (3,)

Notes

  • Input CIE XYZ colourspace matrix is in domain [0, 1].

Examples

>>> XYZ = np.array([0.1180583421, 0.1034, 0.0515089229])
>>> XYZ_to_sRGB(XYZ)  
array([ 0.4822488...,  0.3165197...,  0.2207051...])
colour.models.spectral_to_aces_relative_exposure_values(spd, illuminant=<colour.colorimetry.spectrum.SpectralPowerDistribution object at 0x102e126d0>)

Converts given spectral power distribution to ACES RGB colourspace relative exposure values.

Parameters:
  • spd (SpectralPowerDistribution) – Spectral power distribution.
  • illuminant (SpectralPowerDistribution, optional) – Illuminant spectral power distribution.
Returns:

ACES RGB colourspace relative exposure values matrix.

Return type:

ndarray, (3,)

Notes

  • Output ACES RGB colourspace relative exposure values matrix is in domain [0, 1].

References

Examples

>>> from colour import COLOURCHECKERS_SPDS
>>> spd = COLOURCHECKERS_SPDS['ColorChecker N Ohta']['dark skin']
>>> spectral_to_aces_relative_exposure_values(spd)  
array([ 0.1187697...,  0.0870866...,  0.0589442...])