colour.models.rgb.transfer_functions Package

Module Contents

colour.models.rgb.transfer_functions.log_encoding_ACESproxy(lin_AP1, bit_depth=u'10 Bit')[source]

Defines the ACESproxy colourspace log encoding curve / opto-electronic transfer function.

Parameters:
  • lin_AP1 (numeric or array_like) – lin_AP1 value.
  • bit_depth (unicode, optional) – {‘10 Bit’, ‘12 Bit’}, ACESproxy bit depth.
Returns:

ACESproxy non-linear value.

Return type:

numeric or ndarray

Examples

>>> log_encoding_ACESproxy(0.18)
426
colour.models.rgb.transfer_functions.log_decoding_ACESproxy(ACESproxy, bit_depth=u'10 Bit')[source]

Defines the ACESproxy colourspace log decoding curve / electro-optical transfer function.

Parameters:
  • ACESproxy (numeric or array_like) – ACESproxy non-linear value.
  • bit_depth (unicode, optional) – {‘10 Bit’, ‘12 Bit’}, ACESproxy bit depth.
Returns:

lin_AP1 value.

Return type:

numeric or ndarray

Examples

>>> log_decoding_ACESproxy(426)  
0.1792444...
colour.models.rgb.transfer_functions.log_encoding_ACEScc(lin_AP1)[source]

Defines the ACEScc colourspace log encoding / opto-electronic transfer function.

Parameters:lin_AP1 (numeric or array_like) – lin_AP1 value.
Returns:ACEScc non-linear value.
Return type:numeric or ndarray

Examples

>>> log_encoding_ACEScc(0.18)  
0.4135884...
colour.models.rgb.transfer_functions.log_decoding_ACEScc(ACEScc)[source]

Defines the ACEScc colourspace log decoding / electro-optical transfer function.

Parameters:ACEScc (numeric or array_like) – ACEScc non-linear value.
Returns:lin_AP1 value.
Return type:numeric or ndarray

Examples

>>> log_decoding_ACEScc(0.413588402492442)  
0.1799999...
colour.models.rgb.transfer_functions.log_encoding_ACEScct(lin_AP1)[source]

Defines the ACEScct colourspace log encoding / opto-electronic transfer function.

Parameters:lin_AP1 (numeric or array_like) – lin_AP1 value.
Returns:ACEScct non-linear value.
Return type:numeric or ndarray

Examples

>>> log_encoding_ACEScct(0.18)  
0.4135884...
colour.models.rgb.transfer_functions.log_decoding_ACEScct(ACEScct)[source]

Defines the ACEScct colourspace log decoding / electro-optical transfer function.

Parameters:ACEScct (numeric or array_like) – ACEScct non-linear value.
Returns:lin_AP1 value.
Return type:numeric or ndarray

Examples

>>> log_decoding_ACEScct(0.413588402492442)  
0.1799999...
colour.models.rgb.transfer_functions.log_encoding_ALEXALogC(x, firmware=u'SUP 3.x', method=u'Linear Scene Exposure Factor', EI=800)[source]

Defines the ALEXA Log C log encoding curve / opto-electronic transfer function.

Parameters:
  • x (numeric or array_like) – Linear data \(x\).
  • firmware (unicode, optional) – {‘SUP 3.x’, ‘SUP 2.x’}, Alexa firmware version.
  • method (unicode, optional) – {‘Linear Scene Exposure Factor’, ‘Normalised Sensor Signal’}, Conversion method.
  • EI (int, optional) – Ei.
Returns:

ALEXA Log C encoded data \(t\).

Return type:

numeric or ndarray

Examples

>>> log_encoding_ALEXALogC(0.18)  
0.3910068...
colour.models.rgb.transfer_functions.log_decoding_ALEXALogC(t, firmware=u'SUP 3.x', method=u'Linear Scene Exposure Factor', EI=800)[source]

Defines the ALEXA Log C log decoding curve / electro-optical transfer function.

Parameters:
  • t (numeric or array_like) – ALEXA Log C encoded data \(t\).
  • firmware (unicode, optional) – {‘SUP 3.x’, ‘SUP 2.x’}, Alexa firmware version.
  • method (unicode, optional) – {‘Linear Scene Exposure Factor’, ‘Normalised Sensor Signal’}, Conversion method.
  • EI (int, optional) – Ei.
Returns:

Linear data \(x\).

Return type:

numeric or ndarray

Examples

>>> log_decoding_ALEXALogC(0.391006832034084)  
0.18...
colour.models.rgb.transfer_functions.oetf_BT709(L)[source]

Defines Recommendation ITU-R BT.709-6 opto-electronic transfer function (OETF / OECF).

Parameters:L (numeric or array_like) – Luminance \(L\) of the image.
Returns:Corresponding electrical signal \(V\).
Return type:numeric or ndarray

Examples

>>> oetf_BT709(0.18)  
0.4090077...
colour.models.rgb.transfer_functions.eotf_BT709(V)[source]

Defines Recommendation ITU-R BT.709-6 electro-optical transfer function (EOTF / EOCF).

Parameters:V (numeric or array_like) – Electrical signal \(V\).
Returns:Corresponding luminance \(L\) of the image.
Return type:numeric or ndarray

Warning

Recommendation ITU-R BT.709-6 doesn’t specify an electro-optical transfer function. This definition is used for symmetry in unit tests and other computations but should not be used as an EOTF.

Examples

>>> eotf_BT709(0.409007728864150)  
0.1...
colour.models.rgb.transfer_functions.oetf_BT1886(L, L_B=64, L_W=940)[source]

Defines Recommendation ITU-R BT.1886 opto-electrical transfer function (OETF / OECF).

Parameters:
  • L (numeric or array_like) – Screen luminance in \(cd/m^2\).
  • L_B (numeric, optional) – Screen luminance for black.
  • L_W (numeric, optional) – Screen luminance for white.
Returns:

Input video signal level (normalized, black at \(V = 0\), to white at \(V = 1\).

Return type:

numeric or ndarray

Warning

Recommendation ITU-R BT.1886 doesn’t specify an opto-electrical transfer function. This definition is used for symmetry in unit tests and other computations but should not be used as an OETF.

Examples

>>> oetf_BT1886(277.98159179331145)  
0.4090077...
colour.models.rgb.transfer_functions.eotf_BT1886(V, L_B=64, L_W=940)[source]

Defines Recommendation ITU-R BT.1886 electro-optical transfer function (EOTF / EOCF).

Parameters:
  • V (numeric or array_like) – Input video signal level (normalized, black at \(V = 0\), to white at \(V = 1\). For content mastered per Recommendation ITU-R BT.709, 10-bit digital code values \(D\) map into values of \(V\) per the following equation: \(V = (D–64)/876\)
  • L_B (numeric, optional) – Screen luminance for black.
  • L_W (numeric, optional) – Screen luminance for white.
Returns:

Screen luminance in \(cd/m^2\).

Return type:

numeric or ndarray

Examples

>>> eotf_BT1886(0.409007728864150)  
277.9815917...
colour.models.rgb.transfer_functions.oetf_BT2020(E, is_12_bits_system=False)[source]

Defines Recommendation ITU-R BT.2020 opto-electrical transfer function (OETF / OECF).

Parameters:
  • E (numeric or array_like) – Voltage \(E\) normalized by the reference white level and proportional to the implicit light intensity that would be detected with a reference camera colour channel R, G, B.
  • is_12_bits_system (bool) – BT.709 alpha and beta constants are used if system is not 12-bit.
Returns:

Resulting non-linear signal \(E'\).

Return type:

numeric or ndarray

Examples

>>> oetf_BT2020(0.18)  
0.4090077...
colour.models.rgb.transfer_functions.eotf_BT2020(E_p, is_12_bits_system=False)[source]

Defines Recommendation ITU-R BT.2020 electro-optical transfer function (EOTF / EOCF).

Parameters:
  • E_p (numeric or array_like) – Non-linear signal \(E'\).
  • is_12_bits_system (bool) – BT.709 alpha and beta constants are used if system is not 12-bit.
Returns:

Resulting voltage \(E\).

Return type:

numeric or ndarray

Examples

>>> eotf_BT2020(0.705515089922121)  
0.4999999...
colour.models.rgb.transfer_functions.log_encoding_CanonLog(x)[source]

Defines the Canon Log log encoding curve / opto-electronic transfer function.

Parameters:x (numeric or array_like) – Linear data \(x\).
Returns:Canon Log non-linear IRE data.
Return type:numeric or ndarray

Notes

  • Output Canon Log non-linear IRE data should be converted to code value CV as follows: CV = IRE * (940 - 64) + 64.

Examples

>>> log_encoding_CanonLog(0.20) * 100  
32.7953896...
colour.models.rgb.transfer_functions.log_decoding_CanonLog(clog_ire)[source]

Defines the Canon Log log decoding curve / electro-optical transfer function.

Parameters:clog_ire (numeric or array_like) – Canon Log non-linear IRE data.
Returns:Linear data \(x\).
Return type:numeric or ndarray

Notes

  • Input Canon Log non-linear IRE data should be converted from code value CV to IRE as follows: IRE = (CV - 64) / (940 - 64).

Examples

>>> log_decoding_CanonLog(32.795389693580908 / 100)  
0.19999999...
colour.models.rgb.transfer_functions.log_encoding_CanonLog2(x)[source]

Defines the Canon Log 2 log encoding curve / opto-electronic transfer function.

Parameters:x (numeric or array_like) – Linear data \(x\).
Returns:Canon Log 2 non-linear IRE data.
Return type:numeric or ndarray

Notes

  • Output Canon Log 2 non-linear IRE data should be converted to code value CV as follows: CV = IRE * (940 - 64) + 64.

Examples

>>> log_encoding_CanonLog2(0.20) * 100  
39.2025745...
colour.models.rgb.transfer_functions.log_decoding_CanonLog2(clog2_ire)[source]

Defines the Canon Log 2 log decoding curve / electro-optical transfer function.

Parameters:clog2_ire (numeric or array_like) – Canon Log 2 non-linear IRE data.
Returns:Linear data \(x\).
Return type:numeric or ndarray

Notes

  • Input Canon Log 2 non-linear IRE data should be converted from code value CV to IRE as follows: IRE = (CV - 64) / (940 - 64).

Examples

>>> log_decoding_CanonLog2(39.202574539700947 / 100)  
0.2000000...
colour.models.rgb.transfer_functions.log_encoding_CanonLog3(x)[source]

Defines the Canon Log 3 log encoding curve / opto-electronic transfer function.

Parameters:x (numeric or array_like) – Linear data \(x\).
Returns:Canon Log 3 non-linear IRE data.
Return type:numeric or ndarray

Notes

  • Output Canon Log 3 non-linear IRE data should be converted to code value CV as follows: CV = IRE * (940 - 64) + 64.

Examples

>>> log_encoding_CanonLog3(0.20) * 100  
32.7953567...
colour.models.rgb.transfer_functions.log_decoding_CanonLog3(clog3_ire)[source]

Defines the Canon Log 3 log decoding curve / electro-optical transfer function.

Parameters:clog3_ire (numeric or array_like) – Canon Log 3 non-linear IRE data.
Returns:Linear data \(x\).
Return type:numeric or ndarray

Notes

  • Input Canon Log 3 non-linear IRE data should be converted from code value CV to IRE as follows: IRE = (CV - 64) / (940 - 64).

Examples

>>> log_decoding_CanonLog3(32.795356721989336 / 100)  
0.2000000...
colour.models.rgb.transfer_functions.log_encoding_Cineon(x, black_offset=0.0107977516232771)[source]

Defines the Cineon log encoding curve / opto-electronic transfer function.

Parameters:
  • x (numeric or array_like) – Linear data \(x\).
  • black_offset (numeric or array_like) – Black offset.
Returns:

Non-linear data \(y\).

Return type:

numeric or ndarray

Examples

>>> log_encoding_Cineon(0.18)  
0.4573196...
colour.models.rgb.transfer_functions.log_decoding_Cineon(y, black_offset=0.0107977516232771)[source]

Defines the Cineon log decoding curve / electro-optical transfer function.

Parameters:
  • y (numeric or array_like) – Non-linear data \(y\).
  • black_offset (numeric or array_like) – Black offset.
Returns:

Linear data \(x\).

Return type:

numeric or ndarray

Examples

>>> log_decoding_Cineon(0.457319613085418)  
0.1799999...
colour.models.rgb.transfer_functions.oetf_DCIP3(XYZ)[source]

Defines the DCI-P3 colourspace opto-electronic transfer function (OETF / OECF).

Parameters:XYZ (numeric or array_like) – CIE XYZ tristimulus values.
Returns:Non-linear CIE XYZ’ tristimulus values.
Return type:numeric or ndarray

Examples

>>> oetf_DCIP3(0.18)  
461.9922059...
colour.models.rgb.transfer_functions.eotf_DCIP3(XYZ_p)[source]

Defines the DCI-P3 colourspace electro-optical transfer function (EOTF / EOCF).

Parameters:XYZ_p (numeric or array_like) – Non-linear CIE XYZ’ tristimulus values.
Returns:CIE XYZ tristimulus values.
Return type:numeric or ndarray

Examples

>>> eotf_DCIP3(461.99220597484737)  
0.18...
colour.models.rgb.transfer_functions.gamma_function(a, exponent=1, negative_number_handling=u'indeterminate')[source]

Defines a typical gamma encoding / decoding function.

Parameters:
  • a (numeric or array_like) – Array to encode / decode.
  • exponent (numeric or array_like, optional) – Encoding / decoding exponent.
  • negative_number_handling (unicode, optional) –

    {‘Indeterminate’, ‘Mirror’, ‘Preserve’, ‘Clamp’}, Defines the behaviour for a negative numbers and / or the definition return value:

    • Indeterminate: The behaviour will be indeterminate and definition return value might contain nans.
    • Mirror: The definition return value will be mirrored around abscissa and ordinate axis, i.e. Blackmagic Design: Davinci Resolve behaviour.
    • Preserve: The definition will preserve any negative number in a, i.e. The Foundry Nuke behaviour.
    • Clamp: The definition will clamp any negative number in a to 0.
Returns:

Encoded / decoded array.

Return type:

numeric or ndarray

Raises:

ValueError – If the negative number handling method is not defined.

Examples

>>> gamma_function(0.18, 2.2)  
0.0229932...
>>> gamma_function(-0.18, 2.0)  
0.0323999...
>>> gamma_function(-0.18, 2.2)
nan
>>> gamma_function(-0.18, 2.2, 'Mirror')  
-0.0229932...
>>> gamma_function(-0.18, 2.2, 'Preserve')  
-0.1...
>>> gamma_function(-0.18, 2.2, 'Clamp')  
0.0
colour.models.rgb.transfer_functions.linear_function(a)[source]

Defines a typical linear encoding / decoding function, essentially a pass-through function.

Parameters:a (numeric or array_like) – Array to encode / decode.
Returns:Encoded / decoded array.
Return type:numeric or ndarray

Examples

>>> linear_function(0.18)
0.18
colour.models.rgb.transfer_functions.log_encoding_Panalog(x, black_offset=0.04077184461038074)[source]

Defines the Panalog log encoding curve / opto-electronic transfer function.

Parameters:
  • x (numeric or array_like) – Linear data \(x\).
  • black_offset (numeric or array_like) – Black offset.
Returns:

Non-linear data \(y\).

Return type:

numeric or ndarray

Warning

These are estimations known to be close enough, the actual log encoding curves are not published.

Examples

>>> log_encoding_Panalog(0.18)  
0.3745767...
colour.models.rgb.transfer_functions.log_decoding_Panalog(y, black_offset=0.04077184461038074)[source]

Defines the Panalog log decoding curve / electro-optical transfer function.

Parameters:
  • y (numeric or array_like) – Non-linear data \(y\).
  • black_offset (numeric or array_like) – Black offset.
Returns:

Linear data \(x\).

Return type:

numeric or ndarray

Warning

These are estimations known to be close enough, the actual log encoding curves are not published.

Examples

>>> log_decoding_Panalog(0.374576791382298)  
0.1...
colour.models.rgb.transfer_functions.log_encoding_VLog(L_in)[source]

Defines the Panasonic V-Log log encoding curve / opto-electronic transfer function.

Parameters:L_in (numeric or array_like) – Linear reflection data :math`L_{in}`.
Returns:Non-linear data \(V_{out}\).
Return type:numeric or ndarray

Examples

>>> log_encoding_VLog(0.18)  
0.4233114...
colour.models.rgb.transfer_functions.log_decoding_VLog(V_out)[source]

Defines the Panasonic V-Log log decoding curve / electro-optical transfer function.

Parameters:V_out (numeric or array_like) – Non-linear data \(V_{out}\).
Returns:Linear reflection data :math`L_{in}`.
Return type:numeric or ndarray

Examples

>>> log_decoding_VLog(0.423311448760136)  
0.1799999...
colour.models.rgb.transfer_functions.log_encoding_PivotedLog(x, log_reference=445, linear_reference=0.18, negative_gamma=0.6, density_per_code_value=0.002)[source]

Defines the Josh Pines style Pivoted Log log encoding curve / opto-electronic transfer function.

Parameters:
  • x (numeric or array_like) – Linear data \(x\).
  • log_reference (numeric or array_like) – Log reference.
  • linear_reference (numeric or array_like) – Linear reference.
  • negative_gamma (numeric or array_like) – Negative gamma.
  • density_per_code_value (numeric or array_like) – Density per code value.
Returns:

Non-linear data \(y\).

Return type:

numeric or ndarray

Examples

>>> log_encoding_PivotedLog(0.18)  
0.4349951...
colour.models.rgb.transfer_functions.log_decoding_PivotedLog(y, log_reference=445, linear_reference=0.18, negative_gamma=0.6, density_per_code_value=0.002)[source]

Defines the Josh Pines style Pivoted Log log decoding curve / electro-optical transfer function.

Parameters:
  • y (numeric or array_like) – Non-linear data \(y\).
  • log_reference (numeric or array_like) – Log reference.
  • linear_reference (numeric or array_like) – Linear reference.
  • negative_gamma (numeric or array_like) – Negative gamma.
  • density_per_code_value (numeric or array_like) – Density per code value.
Returns:

Linear data \(x\).

Return type:

numeric or ndarray

Examples

>>> log_decoding_PivotedLog(0.434995112414467)  
0.1...
colour.models.rgb.transfer_functions.log_encoding_REDLog(x, black_offset=0.009955040995908344)[source]

Defines the REDLog log encoding curve / opto-electronic transfer function.

Parameters:
  • x (numeric or array_like) – Linear data \(x\).
  • black_offset (numeric or array_like) – Black offset.
Returns:

Non-linear data \(y\).

Return type:

numeric or ndarray

Examples

>>> log_encoding_REDLog(0.18)  
0.6376218...
colour.models.rgb.transfer_functions.log_decoding_REDLog(y, black_offset=0.009955040995908344)[source]

Defines the REDLog log decoding curve / electro-optical transfer function.

Parameters:
  • y (numeric or array_like) – Non-linear data \(y\).
  • black_offset (numeric or array_like) – Black offset.
Returns:

Linear data \(x\).

Return type:

numeric or ndarray

Examples

>>> log_decoding_REDLog(0.637621845988175)  
0.1...
colour.models.rgb.transfer_functions.log_encoding_REDLogFilm(x, black_offset=0.0107977516232771)[source]

Defines the REDLogFilm log encoding curve / opto-electronic transfer function.

Parameters:
  • x (numeric or array_like) – Linear data \(x\).
  • black_offset (numeric or array_like) – Black offset.
Returns:

Non-linear data \(y\).

Return type:

numeric or ndarray

Examples

>>> log_encoding_REDLogFilm(0.18)  
0.4573196...
colour.models.rgb.transfer_functions.log_decoding_REDLogFilm(y, black_offset=0.0107977516232771)[source]

Defines the REDLogFilm log decoding curve / electro-optical transfer function.

Parameters:
  • y (numeric or array_like) – Non-linear data \(y\).
  • black_offset (numeric or array_like) – Black offset.
Returns:

Linear data \(x\).

Return type:

numeric or ndarray

Examples

>>> log_decoding_REDLogFilm(0.457319613085418)  
0.1799999...
colour.models.rgb.transfer_functions.log_encoding_Log3G10(x, legacy_curve=False)[source]

Defines the Log3G10 log encoding curve / opto-electronic transfer function.

Parameters:
  • x (numeric or array_like) – Linear data \(x\).
  • legacy_curve (bool, optional) – Whether to use the v1 Log3G10 log encoding curve. Default is False.
Returns:

Non-linear data \(y\).

Return type:

numeric or ndarray

Notes

  • The v1 Log3G10 log encoding curve is the one used in REDCINE-X beta 42. Resolve 12.5.2 also uses the v1 curve. RED is planning to use v2 Log3G10 log encoding curve in the release version of the RED SDK. Use the legacy_curve=True argument to switch to the v1 curve for compatibility with the current (as of September 21, 2016) RED SDK.

  • The intent of the v1 Log3G10 log encoding curve is that zero maps to zero, 0.18 maps to 1/3, and 10 stops above 0.18 maps to 1.0. The name indicates this in a similar way to the naming conventions of Sony HyperGamma curves.

    The constants used in the functions do not in fact quite hit these values, but rather than use corrected constants, the functions here use the official RED values, in order to match the output of the RED SDK.

    For those interested, solving for constants which exactly hit 1/3 and 1.0 yields the following values:

    B = 25 * (np.sqrt(4093.0) - 3) / 9
    A = 1 / np.log10(B * 184.32 + 1)
    

    where the function takes the form:

    Log3G10(x) = A * np.log10(B * x + 1)
    

    Similarly for Log3G12, the values which hit exactly 1/3 and 1.0 are:

    B = 25 * (np.sqrt(16381.0) - 3) / 9
    A = 1 / np.log10(B * 737.28 + 1)
    

Examples

>>> log_encoding_Log3G10(0.18, legacy_curve=True)  
0.3333336...
>>> log_encoding_Log3G10(0.0)  
0.0915514...
colour.models.rgb.transfer_functions.log_decoding_Log3G10(y, legacy_curve=False)[source]

Defines the Log3G10 log decoding curve / electro-optical transfer function.

Parameters:
  • y (numeric or array_like) – Non-linear data \(y\).
  • legacy_curve (bool, optional) – Whether to use the v1 Log3G10 log encoding curve. Default is False.
Returns:

Linear data \(x\).

Return type:

numeric or ndarray

Examples

>>> log_decoding_Log3G10(1.0 / 3, legacy_curve=True)  
0.1799994...
>>> log_decoding_Log3G10(1.0)  
184.3223476...
colour.models.rgb.transfer_functions.log_encoding_Log3G12(x)[source]

Defines the Log3G12 log encoding curve / opto-electronic transfer function.

Parameters:x (numeric or array_like) – Linear data \(x\).
Returns:Non-linear data \(y\).
Return type:numeric or ndarray

Examples

>>> log_encoding_Log3G12(0.18)  
0.3333326...
colour.models.rgb.transfer_functions.log_decoding_Log3G12(y)[source]

Defines the Log3G12 log decoding curve / electro-optical transfer function.

Parameters:y (numeric or array_like) – Non-linear data \(y\).
Returns:Linear data \(x\).
Return type:numeric or ndarray

Examples

>>> log_decoding_Log3G12(1.0 / 3)  
0.1800015...
colour.models.rgb.transfer_functions.oetf_ROMMRGB(X, I_max=255)[source]

Defines the ROMM RGB encoding opto-electronic transfer function (OETF / OECF).

Parameters:
  • X (numeric or array_like) – Linear data \(X_{ROMM}\).
  • I_max (numeric, optional) – Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
Returns:

Non-linear data \(X'_{ROMM}\).

Return type:

numeric or ndarray

Examples

>>> oetf_ROMMRGB(0.18)  
98.3564133...
colour.models.rgb.transfer_functions.eotf_ROMMRGB(X_p, I_max=255)[source]

Defines the ROMM RGB encoding electro-optical transfer function (EOTF / EOCF).

Parameters:
  • X_p (numeric or array_like) – Non-linear data \(X'_{ROMM}\).
  • I_max (numeric, optional) – Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
Returns:

Linear data \(X_{ROMM}\).

Return type:

numeric or ndarray

Examples

>>> eotf_ROMMRGB(98.356413311540095) 
0.1...
colour.models.rgb.transfer_functions.oetf_ProPhotoRGB(X, I_max=255)

Defines the ROMM RGB encoding opto-electronic transfer function (OETF / OECF).

Parameters:
  • X (numeric or array_like) – Linear data \(X_{ROMM}\).
  • I_max (numeric, optional) – Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
Returns:

Non-linear data \(X'_{ROMM}\).

Return type:

numeric or ndarray

Examples

>>> oetf_ROMMRGB(0.18)  
98.3564133...
colour.models.rgb.transfer_functions.eotf_ProPhotoRGB(X_p, I_max=255)

Defines the ROMM RGB encoding electro-optical transfer function (EOTF / EOCF).

Parameters:
  • X_p (numeric or array_like) – Non-linear data \(X'_{ROMM}\).
  • I_max (numeric, optional) – Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
Returns:

Linear data \(X_{ROMM}\).

Return type:

numeric or ndarray

Examples

>>> eotf_ROMMRGB(98.356413311540095) 
0.1...
colour.models.rgb.transfer_functions.oetf_RIMMRGB(X, I_max=255, E_clip=2.0)[source]

Defines the RIMM RGB encoding opto-electronic transfer function (OETF / OECF).

RIMM RGB encoding non-linearity is based on that specified by Recommendation ITU-R BT.709-6.

Parameters:
  • X (numeric or array_like) – Linear data \(X_{RIMM}\).
  • I_max (numeric, optional) – Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
  • E_clip (numeric, optional) – Maximum exposure level.
Returns:

Non-linear data \(X'_{RIMM}\).

Return type:

numeric or ndarray

Examples

>>> oetf_RIMMRGB(0.18)  
74.3768017...
colour.models.rgb.transfer_functions.eotf_RIMMRGB(X_p, I_max=255, E_clip=2.0)[source]

Defines the RIMM RGB encoding electro-optical transfer function (EOTF / EOCF).

Parameters:
  • X_p (numeric or array_like) – Non-linear data \(X'_{RIMM}\).
  • I_max (numeric, optional) – Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
  • E_clip (numeric, optional) – Maximum exposure level.
Returns:

Linear data \(X_{RIMM}\).

Return type:

numeric or ndarray

Examples

>>> eotf_RIMMRGB(74.37680178131521)  
0.1...
colour.models.rgb.transfer_functions.log_encoding_ERIMMRGB(X, I_max=255, E_min=0.001, E_clip=316.2)[source]

Defines the ERIMM RGB log encoding curve / opto-electronic transfer function (OETF / OECF).

Parameters:
  • X (numeric or array_like) – Linear data \(X_{ERIMM}\).
  • I_max (numeric, optional) – Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
  • E_min (numeric, optional) – Minimum exposure limit.
  • E_clip (numeric, optional) – Maximum exposure limit.
Returns:

Non-linear data \(X'_{ERIMM}\).

Return type:

numeric or ndarray

Examples

>>> log_encoding_ERIMMRGB(0.18)  
104.5633593...
colour.models.rgb.transfer_functions.log_decoding_ERIMMRGB(X_p, I_max=255, E_min=0.001, E_clip=316.2)[source]

Defines the ERIMM RGB log decoding curve / electro-optical transfer function (EOTF / EOCF).

Parameters:
  • X_p (numeric or array_like) – Non-linear data \(X'_{ERIMM}\).
  • I_max (numeric, optional) – Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
  • E_min (numeric, optional) – Minimum exposure limit.
  • E_clip (numeric, optional) – Maximum exposure limit.
Returns:

Linear data \(X_{ERIMM}\).

Return type:

numeric or ndarray

Examples

>>> log_decoding_ERIMMRGB(104.56335932049294) 
0.1...
colour.models.rgb.transfer_functions.log_encoding_SLog(t)[source]

Defines the Sony S-Log log encoding curve / opto-electronic transfer function.

Parameters:t (numeric or array_like) – Input light level \(t\) to a camera.
Returns:Camera output code \(y\).
Return type:numeric or ndarray

Examples

>>> log_encoding_SLog(0.18)  
0.3599878...
colour.models.rgb.transfer_functions.log_decoding_SLog(y)[source]

Defines the Sony S-Log log decoding curve / electro-optical transfer function.

Parameters:y (numeric or array_like) – Camera output code \(y\).
Returns:Input light level \(t\) to a camera.
Return type:numeric or ndarray

Examples

>>> log_decoding_SLog(0.359987846422154)  
0.1...
colour.models.rgb.transfer_functions.log_encoding_SLog2(t)[source]

Defines the Sony S-Log2 log encoding curve / opto-electronic transfer function.

Parameters:t (numeric or array_like) – Input light level \(t\) to a camera.
Returns:Camera output code \(y\).
Return type:numeric or ndarray

Examples

>>> log_encoding_SLog2(0.18)  
0.3849708...
colour.models.rgb.transfer_functions.log_decoding_SLog2(y)[source]

Defines the Sony S-Log2 log decoding curve / electro-optical transfer function.

Parameters:y (numeric or array_like) – Camera output code \(y\).
Returns:Input light level \(t\) to a camera.
Return type:numeric or ndarray

Examples

>>> log_decoding_SLog2(0.384970815928670)  
0.1...
colour.models.rgb.transfer_functions.log_encoding_SLog3(t)[source]

Defines the Sony S-Log3 log encoding curve / opto-electronic transfer function.

Parameters:t (numeric or array_like) – Input light level \(t\) to a camera.
Returns:Camera output code \(y\).
Return type:numeric or ndarray

Examples

>>> log_encoding_SLog3(0.18)  
0.4105571...
colour.models.rgb.transfer_functions.log_decoding_SLog3(y)[source]

Defines the Sony S-Log3 log decoding curve / electro-optical transfer function.

Parameters:y (numeric or array_like) – Camera output code \(y\).
Returns:Input light level \(t\) to a camera.
Return type:numeric or ndarray

Examples

>>> log_decoding_SLog3(0.410557184750733)  
0.1...
colour.models.rgb.transfer_functions.oetf_sRGB(L)[source]

Defines the sRGB colourspace opto-electronic transfer function (OETF / OECF).

Parameters:L (numeric or array_like) – Luminance \(L\) of the image.
Returns:Corresponding electrical signal \(V\).
Return type:numeric or ndarray

Examples

>>> oetf_sRGB(0.18)  
0.4613561...
colour.models.rgb.transfer_functions.eotf_sRGB(V)[source]

Defines the sRGB colourspace electro-optical transfer function (EOTF / EOCF).

Parameters:V (numeric or array_like) – Electrical signal \(V\).
Returns:Corresponding luminance \(L\) of the image.
Return type:numeric or ndarray

Examples

>>> eotf_sRGB(0.461356129500442)  
0.1...
colour.models.rgb.transfer_functions.oetf_ST2084(C, L_p=10000)[source]

Defines SMPTE ST 2084:2014 optimised perceptual opto-electronic transfer function (OETF / OECF).

Parameters:
  • C (numeric or array_like) – Target optical output \(C\) in \(cd/m^2\) of the ideal reference display.
  • L_p (numeric, optional) – Display peak luminance \(cd/m^2\).
Returns:

Color value abbreviated as \(N\), normalized to the range [0, 1], that is directly proportional to the encoded signal representation, and which is not directly proportional to the optical output of a display device.

Return type:

numeric or ndarray

Examples

>>> oetf_ST2084(0.18)  
0.0794209...
colour.models.rgb.transfer_functions.eotf_ST2084(N, L_p=10000)[source]

Defines SMPTE ST 2084:2014 optimised perceptual electro-optical transfer function (EOTF / EOCF).

This perceptual quantizer (PQ) has been modeled by Dolby Laboratories using Barten (1999) contrast sensitivity function.

Parameters:
  • N (numeric or array_like) – Color value abbreviated as \(N\), normalized to the range [0, 1], that is directly proportional to the encoded signal representation, and which is not directly proportional to the optical output of a display device.
  • L_p (numeric, optional) – Display peak luminance \(cd/m^2\).
Returns:

Target optical output \(C\) in \(cd/m^2\) of the ideal reference display.

Return type:

numeric or ndarray

Examples

>>> eotf_ST2084(0.079420969944927)  
0.1...
colour.models.rgb.transfer_functions.log_decoding_ViperLog(y)[source]

Defines the Viper Log log decoding curve / electro-optical transfer function.

Parameters:y (numeric or array_like) – Non-linear data \(y\).
Returns:Linear data \(x\).
Return type:numeric or ndarray

Examples

>>> log_decoding_ViperLog(0.636008067010413)  
0.1799999...
colour.models.rgb.transfer_functions.log_decoding_ViperLog(y)[source]

Defines the Viper Log log decoding curve / electro-optical transfer function.

Parameters:y (numeric or array_like) – Non-linear data \(y\).
Returns:Linear data \(x\).
Return type:numeric or ndarray

Examples

>>> log_decoding_ViperLog(0.636008067010413)  
0.1799999...
colour.models.rgb.transfer_functions.LOG_ENCODING_CURVES = CaseInsensitiveMapping({'ACEScc': <function log_encoding_ACEScc>, 'ACEScct': <function log_encoding_ACEScct>, 'Log3G12': <function log_encoding_Log3G12>, 'Log3G10': <function log_encoding_Log3G10>, 'ACESproxy': <function log_encoding_ACESproxy>, 'Canon Log': <function log_encoding_CanonLog>, 'REDLogFilm': <function log_encoding_REDLogFilm>, 'S-Log3': <function log_encoding_SLog3>, 'Cineon': <function log_encoding_Cineon>, 'Panalog': <function log_encoding_Panalog>, 'ERIMM RGB': <function log_encoding_ERIMMRGB>, 'PLog': <function log_encoding_PivotedLog>, 'Canon Log 2': <function log_encoding_CanonLog2>, 'S-Log': <function log_encoding_SLog>, 'ALEXA Log C': <function log_encoding_ALEXALogC>, 'S-Log2': <function log_encoding_SLog2>, 'REDLog': <function log_encoding_REDLog>, 'V-Log': <function log_encoding_VLog>, 'ViperLog': <function log_encoding_ViperLog>, 'Canon Log 3': <function log_encoding_CanonLog3>})

Supported log encoding curves.

LOG_ENCODING_CURVES : CaseInsensitiveMapping
{‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘Canon Log’, ‘Canon Log 2’, ‘Canon Log 3’, ‘ACEScc’, ‘ACEScct’, ‘ACESproxy’, ‘ALEXA Log C’, ‘REDLog’, ‘REDLogFilm’, ‘Log3G10’, ‘Log3G12’, ‘ERIMM RGB, ‘S-Log’, ‘S-Log2’, ‘S-Log3’, ‘V-Log’}
colour.models.rgb.transfer_functions.LOG_DECODING_CURVES = CaseInsensitiveMapping({'ACEScc': <function log_decoding_ACEScc>, 'ACEScct': <function log_decoding_ACEScct>, 'Log3G12': <function log_decoding_Log3G12>, 'Log3G10': <function log_decoding_Log3G10>, 'ACESproxy': <function log_decoding_ACESproxy>, 'Canon Log': <function log_decoding_CanonLog>, 'REDLogFilm': <function log_decoding_REDLogFilm>, 'S-Log3': <function log_decoding_SLog3>, 'Cineon': <function log_decoding_Cineon>, 'Panalog': <function log_decoding_Panalog>, 'ERIMM RGB': <function log_decoding_ERIMMRGB>, 'PLog': <function log_decoding_PivotedLog>, 'Canon Log 2': <function log_decoding_CanonLog2>, 'S-Log': <function log_decoding_SLog>, 'ALEXA Log C': <function log_decoding_ALEXALogC>, 'S-Log2': <function log_decoding_SLog2>, 'REDLog': <function log_decoding_REDLog>, 'V-Log': <function log_decoding_VLog>, 'ViperLog': <function log_decoding_ViperLog>, 'Canon Log 3': <function log_decoding_CanonLog3>})

Supported log decoding curves.

LOG_DECODING_CURVES : CaseInsensitiveMapping
{‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘Canon Log’, ‘Canon Log 2’, ‘Canon Log 3’, ‘ACEScc’, ‘ACEScct’, ‘ACESproxy’, ‘ALEXA Log C’, ‘REDLog’, ‘REDLogFilm’, ‘Log3G10’, ‘Log3G12’, ‘ERIMM RGB, ‘S-Log’, ‘S-Log2’, ‘S-Log3’, ‘V-Log’}
colour.models.rgb.transfer_functions.log_encoding_curve(value, curve='Cineon', **kwargs)[source]

Encodes linear-light values to \(R'G'B'\) video component signal value using given log curve.

Parameters:
  • value (numeric or array_like) – Value.
  • curve (unicode, optional) – {‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘Canon Log’, ‘Canon Log 2’, ‘Canon Log 3’, ‘ACEScc’, ‘ACEScct’, ‘ACESproxy’, ‘ALEXA Log C’, ‘REDLog’, ‘REDLogFilm’, ‘Log3G10’, ‘Log3G12’, ‘ERIMM RGB, ‘S-Log’, ‘S-Log2’, ‘S-Log3’, ‘V-Log’}, Computation curve.
Other Parameters:
 
Returns:

Log value.

Return type:

numeric or ndarray

Examples

>>> log_encoding_curve(0.18)  
0.4573196...
>>> log_encoding_curve(0.18, curve='ACEScc')  
0.4135884...
>>> log_encoding_curve(  
...     0.18, curve='PLog', log_reference=400)
0.3910068...
>>> log_encoding_curve(0.18, curve='S-Log')  
0.3599878...
colour.models.rgb.transfer_functions.log_decoding_curve(value, curve='Cineon', **kwargs)[source]

Decodes \(R'G'B'\) video component signal value to linear-light values using given log curve.

Parameters:
  • value (numeric or array_like) – Value.
  • curve (unicode, optional) – {‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘Canon Log’, ‘Canon Log 2’, ‘Canon Log 3’, ‘ACEScc’, ‘ACEScct’, ‘ACESproxy’, ‘ALEXA Log C’, ‘REDLog’, ‘REDLogFilm’, ‘Log3G10’, ‘Log3G12’, ‘ERIMM RGB, ‘S-Log’, ‘S-Log2’, ‘S-Log3’, ‘V-Log’}, Computation curve.
Other Parameters:
 
Returns:

Log value.

Return type:

numeric or ndarray

Examples

>>> log_decoding_curve(0.457319613085418)  
0.1...
>>> log_decoding_curve(  
...     0.413588402492442, curve='ACEScc')
0.1...
>>> log_decoding_curve(  
...     0.391006842619746, curve='PLog', log_reference=400)
0.1...
>>> log_decoding_curve(  
...     0.359987846422154, curve='S-Log')
0.1...
colour.models.rgb.transfer_functions.OETFS = CaseInsensitiveMapping({'DCI-P3': <function oetf_DCIP3>, 'RIMM RGB': <function oetf_RIMMRGB>, 'BT.1886': <function oetf_BT1886>, 'BT.2020': <function oetf_BT2020>, 'ROMM RGB': <function oetf_ROMMRGB>, 'sRGB': <function oetf_sRGB>, 'ST 2084': <function oetf_ST2084>, 'BT.709': <function oetf_BT709>, 'ProPhoto RGB': <function oetf_ROMMRGB>})

Supported opto-electrical transfer functions (OETF / OECF).

OETFS : CaseInsensitiveMapping
{‘sRGB’, ‘BT.1886’, ‘BT.2020’, ‘BT.709’, ‘DCI-P3’, ‘ROMM RGB’, ‘ProPhoto RGB’, ‘RIMM RGB’, ‘ST 2084’}
colour.models.rgb.transfer_functions.EOTFS = CaseInsensitiveMapping({'DCI-P3': <function eotf_DCIP3>, 'RIMM RGB': <function eotf_RIMMRGB>, 'BT.1886': <function eotf_BT1886>, 'BT.2020': <function eotf_BT2020>, 'ROMM RGB': <function eotf_ROMMRGB>, 'sRGB': <function eotf_sRGB>, 'ST 2084': <function eotf_ST2084>, 'BT.709': <function eotf_BT709>, 'ProPhoto RGB': <function eotf_ROMMRGB>})

Supported electro-optical transfer functions (EOTF / EOCF).

EOTFS : CaseInsensitiveMapping
{‘sRGB’, ‘BT.1886’, ‘BT.2020’, ‘BT.709’, ‘DCI-P3’, ‘ROMM RGB’, ‘ProPhoto RGB’, ‘RIMM RGB’, ‘ST 2084’}
colour.models.rgb.transfer_functions.oetf(value, function='sRGB', **kwargs)[source]

Encodes estimated tristimulus values in a scene to \(R'G'B'\) video component signal value using given opto-electronic transfer function (OETF / OECF).

Parameters:
  • value (numeric or array_like) – Value.
  • function (unicode, optional) – {‘sRGB’, ‘BT.1886’, ‘BT.2020’, ‘BT.709’, ‘DCI-P3’, ‘ROMM RGB’, ‘ProPhoto RGB’, ‘RIMM RGB’, ‘ST 2084’}, Computation function.
Other Parameters:
 
  • L_B (numeric, optional) – {oetf_BT1886()}, Screen luminance for black.
  • L_W (numeric, optional) – {oetf_BT1886()}, Screen luminance for white.
  • is_12_bits_system (bool) – {oetf_BT2020()}, BT.709 alpha and beta constants are used if system is not 12-bit.
  • I_max (numeric, optional) – {oetf_ROMMRGB(), oetf_RIMMRGB()}, Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
  • E_clip (numeric, optional) – {oetf_RIMMRGB()}, Maximum exposure level.
  • L_p (numeric, optional) – {oetf_ST2084()}, Display peak luminance \(cd/m^2\).
Returns:

\(R'G'B'\) video component signal value.

Return type:

numeric or ndarray

Examples

>>> oetf(0.18)  
0.4613561...
>>> oetf(0.18, function='BT.2020')  
0.4090077...
>>> oetf(  
...     0.18, function='ST 2084', L_p=1000)
0.1820115...
colour.models.rgb.transfer_functions.eotf(value, function='sRGB', **kwargs)[source]

Decodes \(R'G'B'\) video component signal value to tristimulus values at the display using given electro-optical transfer function (EOTF / EOCF).

Parameters:
  • value (numeric or array_like) – Value.
  • function (unicode, optional) – {‘sRGB’, ‘BT.1886’, ‘BT.2020’, ‘BT.709’, ‘DCI-P3’, ‘ROMM RGB’, ‘ProPhoto RGB’, ‘RIMM RGB’, ‘ST 2084’}, Computation function.
Other Parameters:
 
  • L_B (numeric, optional) – {eotf_BT1886()}, Screen luminance for black.
  • L_W (numeric, optional) – {eotf_BT1886()}, Screen luminance for white.
  • is_12_bits_system (bool) – {eotf_BT2020()}, BT.709 alpha and beta constants are used if system is not 12-bit.
  • I_max (numeric, optional) – {eotf_ROMMRGB(), eotf_RIMMRGB()}, Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel.
  • E_clip (numeric, optional) – {eotf_RIMMRGB()}, Maximum exposure level.
  • L_p (numeric, optional) – {eotf_ST2084()}, Display peak luminance \(cd/m^2\).
Returns:

Tristimulus values at the display.

Return type:

numeric or ndarray

Examples

>>> eotf(0.461356129500442)  
0.1...
>>> eotf(0.409007728864150,
...     function='BT.2020')  
0.1...
>>> eotf(  
...     0.182011532850008, function='ST 2084', L_p=1000)
0.1...