Skip to main content

PyQt-based framework for integrating video cameras into research applications

Project description

QVideo: Qt framework for video cameras

PyPI version Python License: GPL v3 Tests Documentation DOI

QVideo is a framework for integrating video cameras into Qt projects (PyQt5, PyQt6, or PySide) 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, binary threshold, and blob coloring.
  • Graphical overlaysQTrackpyWidget for live particle tracking and QYoloWidget for real-time object detection render markers directly on QVideoScreen; composite mode lets the DVR record the annotated scene.
  • 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

Qt binding

QVideo works with PyQt5, PyQt6, or PySide. On x86/x86_64 a binding can be installed alongside QVideo:

pip install "QVideo[pyqt6]"   # PyQt6
pip install "QVideo[pyqt5]"   # PyQt5

Raspberry Pi

PyPI has no prebuilt ARM wheels for PyQt5 or PyQt6, so the system-provided packages must be used instead. Create the virtual environment with --system-site-packages so pip can see them:

sudo apt install python3-pyqt6 python3-pyqt6.qtsvg
python3 -m venv --system-site-packages .venv
source .venv/bin/activate
pip install QVideo

Replace python3-pyqt6 with python3-pyqt5 if you prefer PyQt5.

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

Quick start

import pyqtgraph as pg
from QVideo.cameras.Noise import QNoiseSource
from QVideo.lib import QVideoScreen

pg.mkQApp()

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

screen.show()
source.start()
pg.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.

Filters

Filter Class Description
Gaussian blur QBlurFilter Smoothing with adjustable kernel radius
Canny edge detection QEdgeFilter Edge map with configurable thresholds
RGB channel selection QRGBFilter Pass one or more color channels
Sample and hold QSampleHold Background normalization via a sampled median estimate
Binary threshold QThresholdFilter Convert to binary mask at a configurable level
Blob coloring QBlobFilter Color connected foreground regions with distinct hues
YOLO annotation QYOLOFilter Annotate frames with YOLO bounding boxes (requires ultralytics)

Overlays

Overlays render analysis results directly on the live QVideoScreen and require pip install QVideo[overlays].

Overlay Class Description
Particle tracking QTrackpyWidget Live particle detection and tracking using trackpy
Object detection QYoloWidget Real-time bounding-box detection using YOLO (ultralytics)

Acknowledgements

Work on this project at New York University is supported by the National Science Foundation of the United States under award number DMR-2428983 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.16.1.tar.gz (243.9 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.16.1-py3-none-any.whl (201.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qvideo-3.16.1.tar.gz
  • Upload date:
  • Size: 243.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qvideo-3.16.1.tar.gz
Algorithm Hash digest
SHA256 4929d5433b1627c2dac6985ff28d04fe52800f9f235f71d1088aa687c127a803
MD5 8635ba664d774aaad030a0366db4245d
BLAKE2b-256 33f1108f1b3a948b595b105273d3715b068a6ca9244a56f5ce5631d87da032a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for qvideo-3.16.1.tar.gz:

Publisher: publish.yml on davidgrier/QVideo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: qvideo-3.16.1-py3-none-any.whl
  • Upload date:
  • Size: 201.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qvideo-3.16.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ec13781a72b2915d63193d2f29de97fd2dfa88e98fd0e70053d3ecb97bca200
MD5 801f26039562a1fdfdeb5d5fd5f3b812
BLAKE2b-256 fdd61d7f2ebd67ce49c52dfe1a7bd67ef6ed5e6e53ba54280c98725e4151c27a

See more details on using hashes here.

Provenance

The following attestation bundles were made for qvideo-3.16.1-py3-none-any.whl:

Publisher: publish.yml on davidgrier/QVideo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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