cutcutcodec.core.io.framecaster.from_rgb

cutcutcodec.core.io.framecaster.from_rgb()

Convert a frame from the RGB space to float32 frame in the RGB space.

  • add 1 leading channel to grayscale frame (h x w -> h x w x 1)

  • cast into float32

  • convert limited range to full range (based on UIT-R)

Parameters

framenp.ndarray

The float32, uint8 or uint16 video frame of shape (height, width, [channels]).

is_tvbool

If True, consider the input as a limited range coding.

threadsint, default=0

Number of threads used.

Returns

normalizednp.ndarray[np.float32, np.float32, np.float32]

The normalized frame with [r, g, b] in [0, 1]**3.

Notes

  • It is optimized for C contiguous array.

  • This function makes a safe copy of the input frame, no modification inplace.