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 Distributions
Built Distribution
Hashes for cv2PySide6-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f5e40ca81844168a32e9cb0dc525a9f4a408522303640516e09fbbbb801f4fc |
|
MD5 | 5683e4484651a3a7f3ec3ba1b8c6d5d3 |
|
BLAKE2b-256 | 2083be81b0f0d7787faca15be65e926bdaace82f6aab5aff318dbdd4e00f8573 |