Video#

class mesmerize_core.arrays.LazyVideo(path, min_max=None, as_grayscale=False, rgb_weights=(0.299, 0.587, 0.114))#

LazyVideo reader, basically just a wrapper for decord.VideoReader. Should support opening anything that decord can open.

Requires ``decord`` to be installed: https://github.com/dmlc/decord

Parameters:
  • path (Path or str) – path to video file

  • min_max (Tuple[int, int], optional) – min and max vals of the entire video, uses min and max of 10th frame if not provided

  • as_grayscale (bool, optional) – return grayscale frames upon slicing

  • rgb_weights (Tuple[float, float, float], optional) – (r, g, b) weights used for grayscale conversion if as_graycale is True. default is (0.299, 0.587, 0.114)

property dtype: str#

str data type

property shape: Tuple[int, int, int]#

[n_frames, x, y], RGB color dim not included in shape

property n_frames: int#

int number of frames

property min: float#

int min value of the array if it were fully computed

property max: float#

float max value of the array if it were fully computed

as_numpy()#

NOT RECOMMENDED, THIS COULD BE EXTREMELY LARGE. Converts to a standard numpy array in RAM.

Return type:

np.ndarray

property nbytes: int#

int number of bytes for the array if it were fully computed

property nbytes_gb: float#

float number of gigabytes for the array if it were fully computed

property ndim: int#

int Number of dimensions