videolib.video.Frame

class Frame(standard, quantization=None, dither=False)[source]

Bases: object

Class defining a frame, either of a video or an image. Supported native color representations: rgb, linear_rgb, bgr, linear_bgr, yuv, linear_yuv, xyz. Access as frame.<color_space>. For all others, use the cvt_color submodule.

Initializer.

Parameters:
  • standard (Standard) – Coor standard to which the data conforms.

  • quantization (Optional[int]) – Value to which data will be quantized and scaled back to original range.

  • dither (Optional[bool]) – Flag denoting whether dithering must be applied after quantization.

Methods

quantize

Quantize value to have quantization number of levels, while occupying the same input range.

show

Plot image using matplotlib.

Attributes

height

Height of the Frame

primaries

Color primaries of the Frame's standard

width

Width of the Frame

property height: int[source]

Height of the Frame

property primaries: Dict[str, Tuple[float, float]][source]

Color primaries of the Frame’s standard

quantize(value)[source]

Quantize value to have quantization number of levels, while occupying the same input range.

Parameters:

value (Union[int, ndarray]) – Value to be quantized.

Returns:

Quantized value, if quantization attribute is specified.

Return type:

Union[int, np.ndarray]

show(interactive=False, **kwargs)[source]

Plot image using matplotlib.

Parameters:
  • interactive (Optional[bool]) – Run matplotlib in interactive mode.

  • kwargs – Passed directly to imshow.

Return type:

None

property width: int[source]

Width of the Frame