Skip to main content

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

  1. Subclass QVideoFrame2Array to define image processor with custom processArray method.
  2. Set the video sink of QMediaPlayer as frame source of the processor.
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cv2PySide6-1.0.2.tar.gz (182.6 kB view hashes)

Uploaded Source

Built Distribution

cv2PySide6-1.0.2-py3-none-any.whl (183.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page