colour.models.log_encoding_SLog2#

colour.models.log_encoding_SLog2(x: Annotated[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], 1], bit_depth: int = 10, out_normalised_code_value: bool = True, in_reflection: bool = True) Annotated[ndarray[tuple[Any, ...], dtype[float16 | float32 | float64]], 1][source]#

Apply the Sony S-Log2 log encoding opto-electronic transfer function (OETF).

Parameters:
  • x (Annotated[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], 1]) – Reflection or \(IRE / 100\) input light level \(x\) to a camera.

  • bit_depth (int) – Bit-depth used for conversion.

  • out_normalised_code_value (bool) – Whether the Sony S-Log2 non-linear data \(y\) is encoded as normalised code values.

  • in_reflection (bool) – Whether the light level \(x\) to a camera is reflection.

Returns:

Sony S-Log2 non-linear encoded data \(y\).

Return type:

numpy.ndarray

Notes

Domain

Scale - Reference

Scale - 1

x

1

1

Range

Scale - Reference

Scale - 1

y

1

1

References

[SonyCorporation12]

Examples

>>> log_encoding_SLog2(0.18)
0.3395325...

The values of IRE and CV of S-Log2 @ISO800 table in [SonyCorporation12] are obtained as follows:

>>> x = np.array([0, 18, 90]) / 100
>>> np.around(log_encoding_SLog2(x, 10, False) * 100).astype(np.int_)
array([ 3, 32, 59])
>>> np.around(log_encoding_SLog2(x) * (2**10 - 1)).astype(np.int_)
array([ 90, 347, 582])