cutcutcodec.core.io.framecaster.from_yuv¶
- cutcutcodec.core.io.framecaster.from_yuv()¶
Convert a frame from the YUV space to float32 frame in the Y’PbPr 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]), with optional channel dimension in {1, 3, 4}.
- 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 [y, u, v] in [0, 1] x [-1/2, 1/2]**2.
Notes¶
It is optimized for C contiguous array.
This function makes a safe copy of the input frame, no modification inplace.