Skip to content

Color Processing

color_processing

Helper functions for color math.

Functions:

XYZ_to_kelvin

XYZ_to_kelvin(XYZ)

Convert from CIE XYZ 1931 to the CCT in kelvin.

calc_exposure

calc_exposure(rgb: ndarray, ref_exposure: float = 0.18, metadata: dict | None = None)

Calculates exposure value of the rgb image.

encode_ARRILogC3

encode_ARRILogC3(x)

Encode the ARRI Log C3 EOTF.

kelvin_to_XYZ

kelvin_to_XYZ(CCT)

Convert from a CCT in kelvin to CIE XYZ 1931.

rec709_to_displayP3

rec709_to_displayP3(rgb)

Convert from rec. 709 to diplay P3 gamut.

xyz_to_displayP3

xyz_to_displayP3(XYZ, **kwargs)

Convert from CIE XYZ 1931 to diplay P3 gamut.

xyz_to_srgb

xyz_to_srgb(XYZ, M=None, output_uint8=True, clip=True, apply_matrix=True)

Convert from XYZ (D65) to sRGB using CuPy.

Parameters:

  • XYZ

    (ndarray) –

    Input array of shape (..., 3), dtype float32 or float64.

  • output_uint8

    (bool, default: True ) –

    If True, returns output in 0–255 uint8 range.

  • clip

    (bool, default: True ) –

    If True, clips RGB values to [0, 1] before gamma.

Returns:

  • cp.ndarray: sRGB values, same shape as XYZ (or uint8 if output_uint8 is True).