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
Examples
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.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bab13d2ae25f23c182647bb01ad455b019682f41a4290ff29d38dd8d119677c4 |
|
MD5 | fea0fec4bb38bf1f79cfab3e72ebeafe |
|
BLAKE2b-256 | 7268e3030d77f2ab5b7b99a2b3226cd853a1844b4c25c0424ac58f72dc7bb3b6 |