Video frame pipeline

cv2PySide6.videostream provides pipeline objects to get video stream in numpy array.

class cv2PySide6.videostream.FrameToArrayConverter(*args: Any, **kwargs: Any)[source]

Bases: QObject

Video pipeline component which converts QVideoFrame to numpy array and emits to arrayChanged.

QVideoFrame is first transformed to QImage and then converted to array by converter().

QVideoPlayer sends empty video frame at the end of video. ignoreNullFrame() determines whether null frame should be ignored or empty array should be emitted.

arrayChanged

alias of ndarray

ignoreNullFrame() bool[source]

If True, null QVideoFrame passed to setVideoFrame() is be ignored. Else, empty array with shape (0, 0, 0) is emitted.

setIgnoreNullFrame(ignore: bool)

Update ignoreNullFrame().

setVideoFrame(frame: PySide6.QtMultimedia.QVideoFrame)

Convert QVideoFrame to numpy.ndarray and emit to setArray().

converter() Callable[[PySide6.QtGui.QImage], ndarray][source]

Callable object to convert QImage instance to numpy array. Default is qimage2ndarray.rgb_view.

convertQImageToArray(qimg: PySide6.QtGui.QImage) ndarray[source]

Convert qimg to numpy array. Null image is converted to empty array.

class cv2PySide6.videostream.NDArrayVideoPlayer(*args: Any, **kwargs: Any)[source]

Bases: QMediaPlayer

Minimal implementation of video player which emits frames as numpy arrays to arrayChanged signal.

User may use this class for convenience, or define their own pipeline.

arrayChanged

alias of ndarray

class cv2PySide6.videostream.NDArrayMediaCaptureSession(*args: Any, **kwargs: Any)[source]

Bases: QMediaCaptureSession

Minimal implementation of media capture session which emits frames as numpy arrays to arrayChanged signal.

User may use this class for convenience, or define their own pipeline.

arrayChanged

alias of ndarray