Video¶
Interface to support treating videos like arrays using OpenCV
- class VideoProxy(path: Path | None = None, video: VideoCapture | None = None)[source]¶
Passthrough proxy class to interact with videos as arrays
- property video: VideoCapture¶
Opened video capture object
- property sample_frame: ndarray¶
A stored frame from the video to use when calculating shape and dtype
- property shape: Tuple[int, ...]¶
Shape of video like
(n_frames, height, width, channels)Note that this order flips the order of height and width from typical resolution specifications: eg. 1080p video is typically 1920x1080, but here it would be 1080x1920. This follows opencv’s ordering, which matches expectations when eg. an image is read and plotted with matplotlib: the first index is the position in the 0th dimension - the height, or “y” axis - and the second is the width/x.
- class VideoInterface(shape: Tuple[int, ...] | Any, dtype: str | type | Any | generic)[source]¶
OpenCV interface to treat videos as arrays.
- return_type¶
alias of
VideoProxy
- classmethod check(array: Any) bool[source]¶
Check if array is a string or Path with a supported video extension, or an opened VideoCapture object
- before_validation(array: Any) VideoProxy[source]¶
Get a
VideoProxyobject for this video