Skip to main content

PyQt-based framework for integrating video cameras into research applications

Project description

QVideo: PyQt support for video cameras

PyPI version Python License: GPL v3 Tests

QVideo is a framework for integrating video cameras into PyQt5 projects for scientific research. It provides a unified, registration-based property system so that every camera backend — USB webcams, GenICam devices, FLIR cameras, Raspberry Pi cameras — is controlled through the same API. Property trees, display widgets, and a digital video recorder are built on top of that abstraction and require no camera-specific code.

QVideo interface demo

Features

  • Unified camera APIQCamera subclasses expose adjustable parameters via registerProperty / registerMethod; UI and recording layers consume them without knowing the underlying hardware.
  • Auto-built property treesQCameraTree reads the registered property map and builds a pyqtgraph parameter tree widget automatically.
  • Threaded video sourceQVideoSource wraps any camera in a QThread and emits newFrame(ndarray) at acquisition rate.
  • Composable filter pipelineVideoFilter / QFilterBank sit between source and display; filters include blur, edge detection, RGB channel selection, sample-and-hold, and statistical median variants.
  • Digital video recorder — lossless HDF5 (with timestamps) and OpenCV video formats; QDVRWidget is the composite UI widget.
  • Live displayQVideoScreen supports mouse-aware graphical overlays for annotations, regions of interest, and user interaction.

Installation

pip install QVideo

Optional hardware backends

Backend Extra Notes
GenICam cameras (Vimba, etc.) pip install QVideo[genicam] Requires a vendor-supplied .cti producer file
Raspberry Pi camera pip install QVideo[picamera] Requires picamera2
FLIR / Spinnaker cameras Requires the proprietary PySpin SDK; install that separately

Quick start

from pyqtgraph.Qt import QtWidgets
from QVideo.cameras.Noise import QNoiseSource
from QVideo.lib import QVideoScreen

app = QtWidgets.QApplication([])

source = QNoiseSource()          # synthetic noise — no hardware needed
screen = QVideoScreen()
source.newFrame.connect(screen.setImage)

screen.show()
source.start()
app.exec()

Replace QNoiseSource with QOpenCVSource, QGenicamSource, etc. to switch hardware — the rest of the code is identical.

Camera backends

Backend Class Hardware
cameras/Noise QNoiseCamera Synthetic — no hardware required
cameras/OpenCV QOpenCVCamera USB webcams via OpenCV
cameras/Genicam QGenicamCamera Abstract base for all GenICam/GigE Vision cameras
cameras/Flir QFlirCamera FLIR cameras via GenICam (Spinnaker GenTL producer)
cameras/Basler QBaslerCamera Basler cameras via GenICam (pylon GenTL producer)
cameras/IDS QIDSCamera IDS Imaging cameras via GenICam
cameras/MV QMVCamera Any GenICam camera via MATRIX VISION mvGenTLProducer
cameras/Vimbax QVimbaXCamera Allied Vision cameras via VimbaX GenTL producer
cameras/Picamera QPicamera Raspberry Pi camera module

Writing a new camera backend

Subclass QCamera and implement three methods:

from QVideo.lib import QCamera

class MyCamera(QCamera):

    def _initialize(self) -> bool:
        self.device = open_my_hardware()
        if not self.device:
            return False
        self.registerProperty('exposure',
                              getter=lambda: self.device.get_exposure(),
                              setter=lambda v: self.device.set_exposure(v),
                              ptype=float)
        return True

    def _deinitialize(self) -> None:
        self.device.close()

    def read(self):
        ok, frame = self.device.read_frame()
        return ok, frame

QCameraTree and QVideoSource work with MyCamera immediately — no additional code needed.

Acknowledgements

Work on this project at New York University is supported by the National Science Foundation of the United States under award number DMR-2104837 and by an award from the TAC Program of New York University.

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

qvideo-3.0.0.tar.gz (147.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qvideo-3.0.0-py3-none-any.whl (128.3 kB view details)

Uploaded Python 3

File details

Details for the file qvideo-3.0.0.tar.gz.

File metadata

  • Download URL: qvideo-3.0.0.tar.gz
  • Upload date:
  • Size: 147.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qvideo-3.0.0.tar.gz
Algorithm Hash digest
SHA256 a16489b9022d95b840cb16e34068ffe8b7d8296891a667bc7ee0725c6aad1147
MD5 f327fe4fdcf284ca4698a9eff8c83836
BLAKE2b-256 09a1c701fefe1f6ca54908ed267792952d550622904cfb6ba03c4c5be97e746c

See more details on using hashes here.

File details

Details for the file qvideo-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: qvideo-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 128.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qvideo-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6cf4a76044de800e61b4b007c0ece5415d29c2aafd75aab7306d8fe3b8b51f8
MD5 7da408b5f5845bb0c532582caa6b5c6b
BLAKE2b-256 6ff1b654c1eda31e5e6843d0db4c6e01537296f2e68a2b3d740152acee228248

See more details on using hashes here.

Supported by

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