Camera backends#

Basler#

Basler camera backend via the pylon GenTL producer.

Supports Basler USB3 Vision and GigE Vision cameras through pylon, Basler’s machine-vision SDK. The pylon installer registers GenTL producer paths in GENICAM_GENTL64_PATH, which this backend discovers automatically.

Classes#

QBaslerCamera

Camera backed by a Basler device via the pylon GenTL producer.

QBaslerSource

Threaded video source backed by QBaslerCamera.

QBaslerTree

Parameter tree widget for QBaslerCamera controls.

class QVideo.cameras.Basler.QBaslerCamera(*args, cameraID=0, **kwargs)[source]#

Bases: QGenicamCamera

Camera backed by a Basler device via the pylon GenTL producer.

pylon is Basler’s SDK for machine-vision cameras. It installs separate GenTL producers for USB3 Vision and GigE Vision cameras whose paths are discovered automatically from the GENICAM_GENTL64_PATH environment variable set by the pylon installer.

If pylon is not installed, instantiation raises TypeError.

Parameters:

cameraID (int) – Index of the Basler camera to open. Default: 0.

producer: str | Path | None = None#
class QVideo.cameras.Basler.QBaslerSource(camera=None, cameraID=0)[source]#

Bases: QGenicamSource

Threaded video source backed by QBaslerCamera.

Parameters:
  • camera (QBaslerCamera or None) – Camera instance to wrap. If None, a new QBaslerCamera is created from cameraID.

  • cameraID (int) – Index of the camera to open. Used only when camera is None. Default: 0.

class QVideo.cameras.Basler.QBaslerTree(*args, camera=None, cameraID=0, controls=None, **kwargs)[source]#

Bases: QGenicamTree

Camera property tree for QBaslerCamera.

Builds a QCameraTree with a curated set of controls and sensible default settings for Basler cameras.

Parameters:
  • camera (QBaslerCamera or None) – Camera instance to use. If None, a new QBaslerCamera is created from cameraID.

  • cameraID (int) – Index of the Basler camera to open. Used only when camera is None. Default: 0.

  • controls (list of str or None) – Names of GenICam nodes to show. Default: _DEFAULT_CONTROLS.

IDS Imaging#

IDS Imaging camera backend via the IDS peak GenTL producer.

Supports IDS USB3 Vision and GigE Vision cameras through IDS peak, IDS Imaging’s machine-vision SDK. The IDS peak installer registers GenTL producer paths in GENICAM_GENTL64_PATH.

Classes#

QIDSCamera

Camera backed by an IDS Imaging device via the IDS peak GenTL producer.

QIDSSource

Threaded video source backed by QIDSCamera.

QIDSTree

Parameter tree widget for QIDSCamera controls.

class QVideo.cameras.IDS.QIDSCamera(*args, cameraID=0, **kwargs)[source]#

Bases: QGenicamCamera

Camera backed by an IDS Imaging device via the IDS peak GenTL producer.

IDS peak is IDS Imaging’s SDK for USB3 Vision and GigE Vision cameras. It installs GenTL producers whose paths are discovered automatically from the GENICAM_GENTL64_PATH environment variable set by the IDS peak installer.

If IDS peak is not installed, instantiation raises TypeError.

Parameters:

cameraID (int) – Index of the IDS camera to open. Default: 0.

class QVideo.cameras.IDS.QIDSSource(camera=None, cameraID=0)[source]#

Bases: QGenicamSource

Threaded video source backed by QIDSCamera.

Parameters:
  • camera (QIDSCamera or None) – Camera instance to wrap. If None, a new QIDSCamera is created from cameraID.

  • cameraID (int) – Index of the camera to open. Used only when camera is None. Default: 0.

class QVideo.cameras.IDS.QIDSTree(*args, camera=None, cameraID=0, controls=None, **kwargs)[source]#

Bases: QGenicamTree

Camera property tree for QIDSCamera.

Builds a QCameraTree with a curated set of controls and sensible default settings for IDS Imaging cameras.

Parameters:
  • camera (QIDSCamera or None) – Camera instance to use. If None, a new QIDSCamera is created from cameraID.

  • cameraID (int) – Index of the IDS camera to open. Used only when camera is None. Default: 0.

  • controls (list of str or None) – Names of GenICam nodes to show. Default: _DEFAULT_CONTROLS.

MATRIX VISION mvGenTLProducer (universal)#

Universal GenICam backend via the MATRIX VISION mvGenTLProducer.

Supports any GenICam-compliant camera through the free mvGenTLProducer universal GenTL producer from MATRIX VISION. Installing the mvIMPACT SDK registers the producer path in GENICAM_GENTL64_PATH.

Note

FLIR/Spinnaker cameras are not supported by this backend. Use QVideo.cameras.Flir for FLIR cameras.

Classes#

QMVCamera

Camera backed by any GenICam device via the mvGenTLProducer.

QMVSource

Threaded video source backed by QMVCamera.

QMVTree

Parameter tree widget for QMVCamera controls.

class QVideo.cameras.MV.QMVCamera(*args, cameraID=0, **kwargs)[source]#

Bases: QGenicamCamera

Camera backed by any GenICam-compliant device via the MATRIX VISION mvGenTLProducer universal GenTL producer.

mvGenTLProducer is a free universal GenTL producer from MATRIX VISION that supports a broad range of GenICam-compliant cameras from many manufacturers. Installing the mvIMPACT SDK registers the producer path in GENICAM_GENTL64_PATH automatically.

Note

FLIR/Spinnaker cameras are not supported by this backend; use QFlirCamera instead.

If mvIMPACT SDK is not installed, instantiation raises TypeError.

Parameters:

cameraID (int) – Index of the camera to open. Default: 0.

producer: str | Path | None = None#
class QVideo.cameras.MV.QMVSource(camera=None, cameraID=0)[source]#

Bases: QGenicamSource

Threaded video source backed by QMVCamera.

Parameters:
  • camera (QMVCamera or None) – Camera instance to wrap. If None, a new QMVCamera is created from cameraID.

  • cameraID (int) – Index of the camera to open. Used only when camera is None. Default: 0.

class QVideo.cameras.MV.QMVTree(*args, camera=None, cameraID=0, controls=None, **kwargs)[source]#

Bases: QGenicamTree

Camera property tree for QMVCamera.

Builds a QCameraTree using standard GenICam SFNC node names, suitable for any camera supported by the MATRIX VISION mvGenTLProducer.

Parameters:
  • camera (QMVCamera or None) – Camera instance to use. If None, a new QMVCamera is created from cameraID.

  • cameraID (int) – Index of the camera to open. Used only when camera is None. Default: 0.

  • controls (list of str or None) – Names of GenICam nodes to show. Default: _DEFAULT_CONTROLS.

Noise (reference)#

Synthetic noise camera for testing and development.

Provides a hardware-free camera backend that generates random-noise frames. Use this backend to develop and test QVideo applications without physical camera hardware. It is also the reference implementation for writing new camera backends.

Classes#

QNoiseCamera

Camera that generates random noise frames.

QNoiseSource

Threaded video source backed by QNoiseCamera.

QNoiseTree

Parameter tree widget for QNoiseCamera controls.

class QVideo.cameras.Noise.QNoiseCamera(*args, cameraID=0, blacklevel=48, whitelevel=128, **kwargs)[source]#

Bases: QCamera

Camera that generates random noise frames.

Useful for testing and development without physical camera hardware. All properties are registered on construction; the camera opens automatically.

Parameters:
  • cameraID (int) – Accepted for API consistency with other camera backends; ignored.

  • blacklevel (int) – Minimum pixel value (inclusive). Default: 48.

  • whitelevel (int) – Maximum pixel value (exclusive). Default: 128.

  • *args – Forwarded to QCamera.

  • **kwargs – Forwarded to QCamera.

read()[source]#

Generate and return a random noise frame.

Return type:

tuple[bool, ndarray[tuple[Any, ...], dtype[ubyte]] | None]

Returns:

tuple[bool, ndarray](True, frame) where frame is a grayscale uint8 array of shape (height, width).

class QVideo.cameras.Noise.QNoiseSource(*args, camera=None, **kwargs)[source]#

Bases: QVideoSource

Threaded video source backed by QNoiseCamera.

Parameters:
  • camera (QNoiseCamera or None) – Camera instance to wrap. If None, a new QNoiseCamera is created from the remaining arguments.

  • *args – Forwarded to QNoiseCamera when camera is None.

  • **kwargs – Forwarded to QNoiseCamera when camera is None.

class QVideo.cameras.Noise.QNoiseTree(*args, camera=None, cameraID=0, **kwargs)[source]#

Bases: QCameraTree

Camera tree for a QNoiseCamera.

Convenience subclass of QCameraTree that creates and opens a QNoiseSource automatically.

Parameters:
  • camera (QNoiseCamera or None) – Camera instance to use. If None, a new QNoiseCamera is created.

  • cameraID (int) – Accepted for API consistency with other camera trees; ignored when camera is provided.

  • *args – Positional arguments forwarded to QCameraTree.

  • **kwargs – Keyword arguments forwarded to QCameraTree.

OpenCV#

OpenCV camera backend for USB webcams and V4L2 devices.

Supports USB webcams and any device accessible via OpenCV’s VideoCapture. On Linux the V4L2 backend is selected automatically; all other platforms use CAP_ANY. No vendor SDK is required beyond OpenCV itself.

Resolution and frame-rate selection modes (quality, performance, and explicit) are described in QOpenCVCamera.

Classes#

QOpenCVCamera

Camera backed by OpenCV’s VideoCapture.

QOpenCVSource

Threaded video source backed by QOpenCVCamera.

QOpenCVTree

Parameter tree widget for QOpenCVCamera controls.

QOpenCVDevices

Utility class for probing connected OpenCV-accessible devices.

class QVideo.cameras.OpenCV.QOpenCVCamera(*args, cameraID=0, mirrored=False, flipped=False, gray=False, width=None, height=None, fps=30.0, **kwargs)[source]#

Bases: QCamera

Camera backed by OpenCV’s VideoCapture.

Supports USB webcams and any device accessible via OpenCV. On Linux the V4L2 backend is selected automatically; all other platforms use CAP_ANY.

Resolution and frame rate are configured once at device open time via configure(). Three modes are supported:

  • Quality (default): probes the device, selects the largest supported resolution, and sets fps (default 30 fps).

  • Performance (fps = None): probes the device, selects the smallest supported resolution, and lets the driver maximize frame rate (slo-mo mode).

  • Explicit (width and height both given): applies the requested dimensions and fps directly.

width and height are registered as writable properties. Changes are applied to the open device via OpenCV’s V4L2 backend, which handles the required VIDIOC_STREAMOFF / VIDIOC_S_FMT / VIDIOC_STREAMON cycle internally. The camera mutex serialises these writes against concurrent reads, so no source stop/restart is needed. QOpenCVTree exposes them as read-only display fields; the resolution enum in that tree changes width, height, and fps together. Transform properties (mirrored, flipped) are registered immediately on construction. Device properties (color, and any properties in _PROBED_PROPS that the device supports) are registered inside _initialize() once the capture device is open.

Parameters:
  • cameraID (int) – Index of the camera device to open. Default: 0.

  • mirrored (bool) – Flip the image horizontally. Default: False.

  • flipped (bool) – Flip the image vertically. Default: False.

  • gray (bool) – Initial grayscale state. Equivalent to opening with color=False. Default: False (color output).

  • width (int or None) – Desired frame width [pixels]. Must be paired with height for explicit mode. None triggers auto-selection. Default: None.

  • height (int or None) – Desired frame height [pixels]. Must be paired with width for explicit mode. None triggers auto-selection. Default: None.

  • fps (float or None) – Desired frame rate [fps]. None selects performance mode. Default: 30..

  • *args – Forwarded to QCamera.

  • **kwargs – Forwarded to QCamera.

WIDTH = 3#
HEIGHT = 4#
FPS = 5#
BGR2RGB = 4#
BGR2GRAY = 6#
read()[source]#

Read one frame from the camera.

Applies color conversion and geometric transforms according to the current color, mirrored, and flipped settings.

Return type:

tuple[bool, ndarray[tuple[Any, ...], dtype[ubyte]] | None]

Returns:

tuple[bool, ndarray or None](True, frame) on success, (False, None) when closed.

class QVideo.cameras.OpenCV.QOpenCVSource(*args, camera=None, **kwargs)[source]#

Bases: QVideoSource

Threaded video source backed by QOpenCVCamera.

Parameters:
  • camera (QOpenCVCamera or None) – Camera instance to wrap. If None, a new QOpenCVCamera is created from the remaining arguments.

  • *args – Forwarded to QOpenCVCamera when camera is None.

  • **kwargs – Forwarded to QOpenCVCamera when camera is None.

class QVideo.cameras.OpenCV.QOpenCVTree(*args, camera=None, cameraID=0, mirrored=False, flipped=False, gray=False, **kwargs)[source]#

Bases: QCameraTree

Camera control tree for QOpenCVCamera.

Extends QCameraTree with a resolution dropdown populated from the formats reported by QOpenCVDevices. Selecting an entry atomically updates width, height, and frame rate on the live device without stopping the video source.

Width, height, and fps are displayed as read-only fields. All format changes go through the resolution dropdown.

When no format information is available (e.g. when QMediaDevices is absent and probing fails), the dropdown is omitted and the tree falls back to the standard read-only width/height display.

Parameters:
  • camera (QOpenCVCamera or None) – Camera instance to use. If None, a new QOpenCVCamera is created from the keyword arguments below.

  • cameraID (int) – Index of the camera device to open. Used only when camera is None. Default: 0.

  • mirrored (bool) – Flip the image horizontally. Used only when camera is None. Default: False.

  • flipped (bool) – Flip the image vertically. Used only when camera is None. Default: False.

  • gray (bool) – Open in grayscale mode. Used only when camera is None. Default: False.

  • *args – Positional arguments forwarded to QCameraTree.

  • **kwargs – Keyword arguments forwarded to QCameraTree.

class QVideo.cameras.OpenCV.QOpenCVDevices[source]#

Bases: object

Camera discovery and format enumeration for OpenCV cameras.

Uses QtMultimedia.QMediaDevices when available to enumerate cameras and their supported formats without opening the device. Falls back to trial-and-error probing via OpenCV when QtMultimedia is not present.

All methods are static — this class is a namespace, not instantiated.

static cameras()[source]#

Return a list of available cameras as (index, name) pairs.

The index is the integer cameraID suitable for passing to QOpenCVCamera.

Return type:

list[tuple[int, str]]

Returns:

list[tuple[int, str]](cameraID, description) for each detected camera, sorted by cameraID.

static formats(cameraID=0)[source]#

Return supported formats for camera cameraID.

Each entry is (width, height, 1.0, max_fps) where max_fps is the highest frame rate the driver actually delivers at that resolution, determined by opening the device briefly and querying via OpenCV.

QtMultimedia.QMediaDevices is used to obtain the resolution list when available (it may know about non-standard resolutions that COMMON_RESOLUTIONS does not cover). Frame rates from QtMultimedia are not used because they reflect nominal/declared values that often differ from what the driver accepts.

Parameters:

cameraID (int) – Camera index (same convention as OpenCV VideoCapture).

Return type:

list[tuple[int, int, float, float]]

Returns:

list[tuple[int, int, float, float]](width, height, 1.0, max_fps) for each distinct resolution, sorted by (width, height).

OpenCV device utilities#

Camera and format enumeration for OpenCV-backed cameras.

class QVideo.cameras.OpenCV._devices.QOpenCVDevices[source]#

Bases: object

Camera discovery and format enumeration for OpenCV cameras.

Uses QtMultimedia.QMediaDevices when available to enumerate cameras and their supported formats without opening the device. Falls back to trial-and-error probing via OpenCV when QtMultimedia is not present.

All methods are static — this class is a namespace, not instantiated.

static cameras()[source]#

Return a list of available cameras as (index, name) pairs.

The index is the integer cameraID suitable for passing to QOpenCVCamera.

Return type:

list[tuple[int, str]]

Returns:

list[tuple[int, str]](cameraID, description) for each detected camera, sorted by cameraID.

static formats(cameraID=0)[source]#

Return supported formats for camera cameraID.

Each entry is (width, height, 1.0, max_fps) where max_fps is the highest frame rate the driver actually delivers at that resolution, determined by opening the device briefly and querying via OpenCV.

QtMultimedia.QMediaDevices is used to obtain the resolution list when available (it may know about non-standard resolutions that COMMON_RESOLUTIONS does not cover). Frame rates from QtMultimedia are not used because they reflect nominal/declared values that often differ from what the driver accepts.

Parameters:

cameraID (int) – Camera index (same convention as OpenCV VideoCapture).

Return type:

list[tuple[int, int, float, float]]

Returns:

list[tuple[int, int, float, float]](width, height, 1.0, max_fps) for each distinct resolution, sorted by (width, height).

QVideo.cameras.OpenCV._devices.probe_resolutions(device)[source]#

Return resolutions accepted by an open OpenCV VideoCapture device.

Probes each entry in COMMON_RESOLUTIONS by writing width and height to the device and reading back what it actually accepted. Restores the original resolution and frame rate when done.

Parameters:

device (cv2.VideoCapture) – An already-open capture device.

Return type:

list[tuple[int, int]]

Returns:

list[tuple[int, int]] – Sorted list of (width, height) pairs accepted by the device.

QVideo.cameras.OpenCV._devices.probe_formats(device, resolutions=None)[source]#

Return (width, height, 1.0, max_fps) for each accepted resolution.

For each candidate resolution, the device is asked to deliver 120 fps (above any real hardware limit) and the value the driver accepts is recorded as the maximum. Restores the original resolution and frame rate when done.

Parameters:
  • device (cv2.VideoCapture) – An already-open capture device.

  • resolutions (list[tuple[int, int]] or None) – Resolution candidates to probe. Defaults to COMMON_RESOLUTIONS.

Return type:

list[tuple[int, int, float, float]]

Returns:

list[tuple[int, int, float, float]] – Sorted list of (width, height, 1.0, max_fps) tuples, one per distinct resolution the device accepts.

QVideo.cameras.OpenCV._devices.configure(device, width=None, height=None, fps=30.0, resolutions=None)[source]#

Configure an open OpenCV VideoCapture device.

Three modes:

  • Explicit (both width and height given): apply those values directly, then set fps if provided.

  • Quality (default, fps is not None): select the largest supported resolution, then set fps.

  • Performance (fps is None): select the smallest supported resolution, letting the driver maximize frame rate.

Parameters:
  • device (cv2.VideoCapture) – An already-open capture device.

  • width (int or None) – Desired frame width [pixels]. Must be paired with height for explicit mode. None triggers auto-selection.

  • height (int or None) – Desired frame height [pixels]. Must be paired with width for explicit mode. None triggers auto-selection.

  • fps (float or None) – Desired frame rate [fps]. None selects performance mode (smallest resolution, driver-maximum frame rate). Default: 30..

  • resolutions (list[tuple[int, int]] or None) – Known supported resolutions as (width, height) pairs. When provided, skips trial-and-error probing via probe_resolutions(). None (default) triggers probing.

Return type:

None

GenICam (base)#

Generic GenICam camera backend via Harvesters.

Provides an abstract base for any camera that implements the GenICam standard and is accessible via a GenTL producer .cti file. Camera vendors supply manufacturer-specific producer files; concrete subclasses set the producer class attribute to the appropriate path.

Requires the genicam and harvesters packages:

pip install genicam harvesters

Classes#

QGenicamCamera

Abstract base for GenICam cameras accessed via Harvesters.

QGenicamSource

Threaded video source backed by QGenicamCamera.

QGenicamTree

Parameter tree widget for QGenicamCamera controls.

class QVideo.cameras.Genicam.QGenicamCamera(*args, cameraID=0, **kwargs)#

Bases: QCamera

Abstract base for GenICam-compliant cameras accessed via Harvesters.

GenICam is a standardized machine-vision interface maintained by the European Machine Vision Association. Communication with the physical device is handled by a GenTL producer — a .cti binary supplied by the camera manufacturer.

Subclasses must set the producer class attribute to the path of the appropriate .cti file before instantiating. Attempting to instantiate QGenicamCamera directly raises TypeError.

Requires the genicam and harvesters packages (pip install genicam harvesters).

producer#

Path to the GenTL producer .cti file. Must be overridden by concrete subclasses.

Type:

str or None

Parameters:
  • cameraID (int) – Index of the camera to open. Default: 0.

  • *args – Forwarded to QCamera.

  • **kwargs – Forwarded to QCamera.

has_node(name)[source]#

Return True if the named node exists in the node map.

Unlike node(), this never logs a warning for missing names. Use it to guard calls to node() or is_readwrite() in reactive code paths (e.g. UI update loops) where absent names are expected and not an error.

Parameters:

name (str) – GenICam node name to look up.

Return type:

bool

Returns:

boolTrue if the node map is available and contains name.

is_readwrite(feature)[source]#

Return True if the named feature is currently writable.

Parameters:

feature (str) – GenICam node name.

Return type:

bool

Returns:

boolTrue if the feature is writable, or protected (writable after stopping acquisition).

node(name='Root')[source]#

Return the GenICam node with the given name.

Parameters:

name (str) – Node name to look up. Default: 'Root'.

Returns:

IValue or None – The requested node, or None if it does not exist.

producer: str | Path | None = None#
read()[source]#

Read one frame from the camera.

Return type:

tuple[bool, ndarray[tuple[Any, ...], dtype[ubyte]] | None]

Returns:

tuple[bool, ndarray or None](True, frame) on success, (False, None) on timeout.

set(key, value)[source]#

Set a registered property to the given value.

Parameters:
  • key (str) – Property name.

  • value (PropertyValue) – New value to assign.

Return type:

None

property settings: dict[str, bool | int | float | str]#

All registered property values, excluding standard-name aliases.

GenICam cameras register lowercase aliases (width, height, fps) that map to canonical SFNC node names (Width, Height, AcquisitionFrameRate). Those aliases are excluded here so that QGenicamTree does not try to sync them to tree parameters — the canonical names are already present and do the right thing. Attribute access (camera.fps) still works because __getattr__() reads _properties directly, not settings.

class QVideo.cameras.Genicam.QGenicamSource(camera)#

Bases: QVideoSource

Threaded video source backed by QGenicamCamera.

Parameters:

camera (QGenicamCamera) – Camera instance to wrap.

class QVideo.cameras.Genicam.QGenicamTree(*args, camera, visibility=genicam.genapi.EVisibility.Guru, controls=None, **kwargs)#

Bases: QCameraTree

Camera property tree for QGenicamCamera.

Builds a QCameraTree from the camera’s GenICam node map and exposes visibility and per-feature enable/disable controls.

A timer polls the camera periodically so that autonomous camera-side changes (e.g. Gain being adjusted by auto-exposure, GainAuto reverting from "Once" to "Off") are reflected in the UI. PyNodeCallback is not used because it only fires when the host writes a node, not when the camera changes a value autonomously.

Parameters:
  • camera (QGenicamCamera) – Camera instance to use.

  • visibility (EVisibility) – Maximum GenICam visibility level to display. Default: EVisibility.Guru.

  • controls (list of str or None) – If given, only nodes whose names appear in this list are shown; all others are hidden. Default: None (show all).

  • *args – Forwarded to QCameraTree.

  • **kwargs – Forwarded to QCameraTree.

closeEvent(event)[source]#

Stop the video source when the widget is closed.

Return type:

None

property controls: list[str] | None#
describe(feature)[source]#

Return a dictionary describing a feature

Return type:

dict[str, Any]

description(camera)[source]#

Return a list of dicts describing the node map

Return type:

list[dict]

property visibility: genicam.genapi.EVisibility#
visible(param)[source]#
Return type:

bool

FLIR#

FLIR camera backend via the Spinnaker GenTL producer.

Supports FLIR (formerly Point Grey) USB3 Vision and GigE Vision cameras through Spinnaker, FLIR’s machine-vision SDK. The Spinnaker installer registers the GenTL producer path in GENICAM_GENTL64_PATH.

Warning

Spinnaker GenTL producer 4.3.0.189 contains a bug that causes the application to hang on exit when the camera is released. Downgrade to Spinnaker 4.1.0.172 or earlier if you encounter this issue.

Classes#

QFlirCamera

Camera backed by a FLIR device via the Spinnaker GenTL producer.

QFlirSource

Threaded video source backed by QFlirCamera.

QFlirTree

Parameter tree widget for QFlirCamera controls.

class QVideo.cameras.Flir.QFlirCamera(*args, cameraID=0, **kwargs)[source]#

Bases: QGenicamCamera

Camera backed by a FLIR device via the Spinnaker GenTL producer.

Spinnaker is FLIR’s SDK for machine-vision cameras. It installs a GenTL producer whose path is discovered automatically from the GENICAM_GENTL64_PATH environment variable set by the Spinnaker installer.

If Spinnaker is not installed, instantiation raises TypeError.

Warning

Spinnaker GenTL producer 4.3.0.189 contains a bug in which DevClose() hangs indefinitely when the camera is released. This causes the application to hang on exit. FLIR customer support has confirmed the bug. If you experience this issue, downgrade to Spinnaker 4.1.0.172 or earlier.

Parameters:

cameraID (int) – Index of the FLIR camera to open. Default: 0.

class QVideo.cameras.Flir.QFlirSource(camera=None, cameraID=0)[source]#

Bases: QGenicamSource

Threaded video source backed by QFlirCamera.

Parameters:
  • camera (QFlirCamera or None) – Camera instance to wrap. If None, a new QFlirCamera is created from cameraID.

  • cameraID (int) – Index of the camera to open. Used only when camera is None. Default: 0.

class QVideo.cameras.Flir.QFlirTree(*args, camera=None, cameraID=0, controls=None, **kwargs)[source]#

Bases: QGenicamTree

Camera property tree for QFlirCamera.

Builds a QCameraTree with a curated set of controls and sensible default settings for FLIR cameras.

Parameters:
  • camera (QFlirCamera or None) – Camera instance to use. If None, a new QFlirCamera is created from cameraID.

  • cameraID (int) – Index of the FLIR camera to open. Used only when camera is None. Default: 0.

  • controls (list of str or None) – Names of GenICam nodes to show. Default: _DEFAULT_CONTROLS.

Allied Vision VimbaX#

Allied Vision camera backend via the VimbaX GenTL producer.

Supports Allied Vision GigE Vision and USB3 Vision cameras through VimbaX, Allied Vision’s machine-vision SDK. The VimbaX installer registers GenTL producer paths in GENICAM_GENTL64_PATH.

Classes#

QVimbaXCamera

Camera backed by an Allied Vision device via the VimbaX GenTL producer.

QVimbaXSource

Threaded video source backed by QVimbaXCamera.

QVimbaXTree

Parameter tree widget for QVimbaXCamera controls.

class QVideo.cameras.Vimbax.QVimbaXCamera(*args, cameraID=0, **kwargs)[source]#

Bases: QGenicamCamera

Camera backed by an Allied Vision device via the VimbaX GenTL producer.

VimbaX is Allied Vision’s SDK for GigE Vision and USB3 Vision cameras. It installs a GenTL producer whose path is discovered automatically from the GENICAM_GENTL64_PATH environment variable set by the VimbaX installer.

If VimbaX is not installed, instantiation raises TypeError.

Parameters:

cameraID (int) – Index of the Allied Vision camera to open. Default: 0.

class QVideo.cameras.Vimbax.QVimbaXSource(camera=None, cameraID=0)[source]#

Bases: QGenicamSource

Threaded video source backed by QVimbaXCamera.

Parameters:
  • camera (QVimbaXCamera or None) – Camera instance to wrap. If None, a new QVimbaXCamera is created from cameraID.

  • cameraID (int) – Index of the camera to open. Used only when camera is None. Default: 0.

class QVideo.cameras.Vimbax.QVimbaXTree(*args, camera=None, cameraID=0, **kwargs)[source]#

Bases: QGenicamTree

Camera property tree for Allied Vision VimbaX cameras.

Parameters:
  • camera (QVimbaXCamera or None) – Camera instance to use. If None, a new QVimbaXCamera is created from cameraID.

  • cameraID (int) – Index of the camera device to open. Used only when camera is None. Default: 0.

  • *args, **kwargs – Forwarded to QGenicamTree.

Raspberry Pi Camera#

Raspberry Pi camera backend via picamera2.

Supports all CSI-connected camera modules on a Raspberry Pi SBC, including the HQ Camera, Camera Module 3, and compatible sensors. Frames are delivered as RGB arrays.

Requires the picamera2 package, which is pre-installed on Raspberry Pi OS. Install manually with:

pip install picamera2

Classes#

QPicamera

Camera backed by the Raspberry Pi camera module via picamera2.

QPicameraSource

Threaded video source backed by QPicamera.

QPicameraTree

Parameter tree widget for QPicamera controls.

class QVideo.cameras.Picamera.QPicamera(*args, cameraID=0, width=1280, height=960, gray=False, **kwargs)[source]#

Bases: QCamera

Camera backed by the Raspberry Pi camera module via picamera2.

Supports all CSI-connected camera modules on a Raspberry Pi SBC, including the HQ Camera, Camera Module 3, and similar sensors. Frames are delivered as RGB arrays.

Requires the picamera2 package, which is pre-installed on Raspberry Pi OS. Install manually with:

pip install picamera2
Parameters:
  • cameraID (int) – Index of the camera to open when multiple modules are attached. Default: 0.

  • width (int) – Initial frame width in pixels. Default: 1280.

  • height (int) – Initial frame height in pixels. Default: 960.

  • gray (bool) – True convert frames to grayscale. Default: False.

  • *args – Forwarded to QCamera.

  • **kwargs – Forwarded to QCamera.

read()[source]#

Read one frame from the camera.

Uses capture_request() for direct buffer access, which avoids an extra copy compared to capture_array().

Return type:

tuple[bool, ndarray[tuple[Any, ...], dtype[ubyte]] | None]

Returns:

tuple[bool, ndarray or None](True, frame) on success, (False, None) on failure.

class QVideo.cameras.Picamera.QPicameraSource(*args, camera=None, **kwargs)[source]#

Bases: QVideoSource

Threaded video source backed by QPicamera.

Parameters:
  • camera (QPicamera or None) – Camera instance to wrap. If None, a new QPicamera is created from the remaining arguments.

  • *args – Forwarded to QPicamera when camera is None.

  • **kwargs – Forwarded to QPicamera when camera is None.

class QVideo.cameras.Picamera.QPicameraTree(*args, camera=None, cameraID=0, width=1280, height=960, **kwargs)[source]#

Bases: QCameraTree

Camera control tree for QPicamera.

Convenience subclass of QCameraTree that automatically creates and opens a QPicamera if one is not provided.

Parameters:
  • camera (QPicamera or None) – Camera instance to use. If None, a new QPicamera is created from the keyword arguments below.

  • cameraID (int) – Camera index. Used only when camera is None. Default: 0.

  • width (int) – Initial frame width. Used only when camera is None. Default: 1280.

  • height (int) – Initial frame height. Used only when camera is None. Default: 960.

  • *args – Forwarded to QCameraTree.

  • **kwargs – Forwarded to QCameraTree.