Package for video display with OpenCV-Python and PySide6
Project description
Python package to display video in GUI using OpenCV-Python
and PySide6
.
Introduction
cv2PySide6 is a package which provides utility classes and functions that integrate cv2
and PySide6
.
With cv2PySide6, you can build pipeline which reads video with PySide6
, converts the frame to numpy
array for processing with cv2
, and casts it back to PySide6
object.
Installation
Before you install, be careful for other Qt-dependent packages installed in your environment.
For example, non-headless OpenCV-Python
module modifies the Qt dependency thus making PySide6 unavailable.
cv2PySide6
can be installed using pip
.
$ pip install cv2PySide6
How to use
- Subclass
QVideoFrame2Array
to define image processor with customprocessArray
method. - Set the video sink of
QMediaPlayer
as frame source of the processor. - Set the image processor as array source of
NDArrayVideoWidget
.
In PySide6
, video frames are acquired as QVideoFrame
and passed from QMediaPlayer
to QVideoSink
, then to QVideoWidget
.
Video display pipeline in PySide6
In cv2PySide6
, QVideoFrame2Array
comes after QVideoSink
.
This converts the QVideoFrame
to numpy.ndarray
, process it, then pass to NDArrayVideoWidget
.
You can subclass QVideoFrame2Array
and override processArray
with your own image processing.
Video display pipeline in cv2PySide6
Use cases are provided in examples directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cv2PySide6-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32c64337596c0e5923113153b243e7ff3687672b3d5ed18153cf0aac985a982c |
|
MD5 | 00a9da06a088130237a52435b54db73a |
|
BLAKE2b-256 | b94202cdd84d1e50bf12d893fd19846a6a49082f9528d2b80e5962a35d3c6aea |