colour.models.deprecated Module

Deprecated Colour Models Transformations

Defines various deprecated colour models transformations:

These colour models are stated as deprecated because they trade off perceptual relevance for computation speed. They should not be used in the colour science domain although they are useful for image analysis and provide end user software colour selection tools.

They are provided for convenience and completeness.

Warning

Don’t use that! Seriously...

References

[1]http://en.wikipedia.org/wiki/HSL_and_HSV (Last accessed 10 August 2014)
[2]http://alvyray.com/Papers/CG/color78.pdf (Last accessed 10 August 2014)
colour.models.deprecated.RGB_to_HSV(RGB)[source]

Converts from RGB colourspace to HSV colourspace.

Parameters:RGB (array_like, (3,)) – RGB colourspace matrix.
Returns:HSV matrix.
Return type:ndarray, (3,)

Notes

  • Input RGB colourspace matrix is in domain [0, 1].
  • Output HSV colourspace matrix is in domain [0, 1].

References

[3]http://www.easyrgb.com/index.php?X=MATH&H=20#text20 (Last accessed 18 May 2014)

Examples

>>> RGB = np.array([0.49019608, 0.98039216, 0.25098039])
>>> RGB_to_HSV(RGB)  
array([ 0.2786738...,  0.744     ,  0.98039216])
colour.models.deprecated.HSV_to_RGB(HSV)[source]

Converts from HSV colourspace to RGB colourspace.

Parameters:HSV (array_like, (3,)) – HSV colourspace matrix.
Returns:RGB colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Input HSV colourspace matrix is in domain [0, 1].
  • Output RGB colourspace matrix is in domain [0, 1].

References

[4]http://www.easyrgb.com/index.php?X=MATH&H=21#text21 (Last accessed 18 May 2014)

Examples

>>> HSV = np.array([0.27867384, 0.744, 0.98039216])
>>> HSV_to_RGB(HSV)  
array([ 0.4901960...,  0.9803921...,  0.2509803...])
colour.models.deprecated.RGB_to_HSL(RGB)[source]

Converts from RGB colourspace to HSL colourspace.

Parameters:RGB (array_like, (3,)) – RGB colourspace matrix.
Returns:HSL matrix.
Return type:ndarray, (3,)

Notes

  • Input RGB colourspace matrix is in domain [0, 1].
  • Output HSL colourspace matrix is in domain [0, 1].

References

[5]http://www.easyrgb.com/index.php?X=MATH&H=18#text18 (Last accessed 18 May 2014)

Examples

>>> RGB = np.array([0.49019608, 0.98039216, 0.25098039])
>>> RGB_to_HSL(RGB)  
array([ 0.2786738...,  0.9489796...,  0.6156862...])
colour.models.deprecated.HSL_to_RGB(HSL)[source]

Converts from HSL colourspace to RGB colourspace.

Parameters:HSL (array_like, (3,)) – HSL colourspace matrix.
Returns:RGB colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Input HSL colourspace matrix is in domain [0, 1].
  • Output RGB colourspace matrix is in domain [0, 1].

References

[6]http://www.easyrgb.com/index.php?X=MATH&H=19#text19 (Last accessed 18 May 2014)

Examples

>>> HSL = np.array([0.27867384, 0.94897959, 0.61568627])
>>> HSL_to_RGB(HSL)  
array([ 0.4901960...,  0.9803921...,  0.2509803...])
colour.models.deprecated.RGB_to_CMY(RGB)[source]

Converts from RGB colourspace to CMY colourspace.

Parameters:RGB (array_like, (3,)) – RGB colourspace matrix.
Returns:CMY matrix.
Return type:ndarray, (3,)

Notes

  • Input RGB colourspace matrix is in domain [0, 1].
  • Output CMY colourspace matrix is in domain [0, 1].

References

[7]http://www.easyrgb.com/index.php?X=MATH&H=11#text11 (Last accessed 18 May 2014)

Examples

>>> RGB = np.array([0.49019608, 0.98039216, 0.25098039])
>>> RGB_to_CMY(RGB)  
array([ 0.5098039...,  0.0196078...,  0.7490196...])
colour.models.deprecated.CMY_to_RGB(CMY)[source]

Converts from CMY colourspace to CMY colourspace.

Parameters:CMY (array_like, (3,)) – CMY colourspace matrix.
Returns:RGB colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Input CMY colourspace matrix is in domain [0, 1].
  • Output RGB colourspace matrix is in domain [0, 1].

References

[8]http://www.easyrgb.com/index.php?X=MATH&H=12#text12 (Last accessed 18 May 2014)

Examples

>>> CMY = np.array([0.50980392, 0.01960784, 0.74901961])
>>> CMY_to_RGB(CMY)  
array([ 0.4901960...,  0.9803921...,  0.2509803...])
colour.models.deprecated.CMY_to_CMYK(CMY)[source]

Converts from CMY colourspace to CMYK colourspace.

Parameters:CMY (array_like, (3,)) – CMY colourspace matrix.
Returns:CMYK matrix.
Return type:ndarray, (4,)

Notes

  • Input CMY colourspace matrix is in domain [0, 1].
  • Output*CMYK* colourspace matrix is in domain [0, 1].

References

[9]http://www.easyrgb.com/index.php?X=MATH&H=13#text13 (Last accessed 18 May 2014)

Examples

>>> CMY = np.array([0.50980392, 0.01960784, 0.74901961])
>>> CMY_to_CMYK(CMY)  
array([ 0.5       ,  0.        ,  0.744     ,  0.0196078...])
colour.models.deprecated.CMYK_to_CMY(CMYK)[source]

Converts from CMYK colourspace to CMY colourspace.

Parameters:CMYK (array_like, (4,)) – CMYK colourspace matrix.
Returns:CMY matrix.
Return type:ndarray, (3,)

Notes

  • Input CMYK colourspace matrix is in domain [0, 1].
  • Output CMY colourspace matrix is in domain [0, 1].

References

[10]http://www.easyrgb.com/index.php?X=MATH&H=14#text14

Examples

>>> CMYK = np.array([0.5, 0, 0.744, 0.01960784])
>>> CMYK_to_CMY(CMYK)  
array([ 0.5098039...,  0.0196078...,  0.7490196...])
colour.models.deprecated.RGB_to_HEX(RGB)[source]

Converts from RGB colourspace to hex triplet representation.

Parameters:RGB (array_like, (3,)) – RGB colourspace matrix.
Returns:Hex triplet representation.
Return type:unicode

Notes

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

Examples

>>> RGB = np.array([0.66666667, 0.86666667, 1])
>>> # Doctests skip for Python 2.x compatibility.
>>> RGB_to_HEX(RGB)  
'#aaddff'
colour.models.deprecated.HEX_to_RGB(HEX)[source]

Converts from hex triplet representation to RGB colourspace.

Parameters:HEX (unicode) – Hex triplet representation.
Returns:RGB colourspace matrix.
Return type:ndarray, (3,)

Notes

  • Output RGB colourspace matrix is in domain [0, 1].

Examples

>>> HEX = '#aaddff'
>>> HEX_to_RGB(HEX)  
array([ 0.6666666...,  0.8666666...,  1.        ])