Skip to main content

A library for interacting with Video4Linux2 (V4L2) video devices

Project description

qamlib

This is a library meant to be an easy way to interact with a V4L2 camera, by having a simple interface to capture images, and change camera controls. It is a C++20 class (+ a few structs) together with Python bindings via pybind11.

While the Python bindings are the main usage of qamlib, it is also possible to build qamlib as a (static) C++ library.

Supported features

  • Get/set "normal" and extended V4L2 controls.
  • Get/set image formats.
  • Get/set framesize and cropping.
  • Get/set framerate (FPS).
  • Read out frames from a capture video device as a NumPy array. With or without buffering.
  • Subscribe to events for a V4L2 device.

Planned features

  • Pushing frames to a output video device.
  • Supporting multiplane devices.

There are also some features supported that are currently exclusive to Qtechnology A/S cameras, but these are not compiled when main-line kernel headers are detected.

Example

import qamlib

cam = qamlib.Camera("/dev/video0")

# Use context manager to start and stop streaming
with cam:
    metadata, frame = cam.get_frame() # gets an image as raw bytes
    # process image

See more in the documentation

Building

Python

Building the Python module is done via mesonpy.

Dependencies

  • gcc
  • libstdc++-dev
  • meson
  • mesonpy
  • nlohmann-json
  • pybind11
  • pybind11_json
  • python3-build
  • python3-dev

To build the module:

python -m build

C++

Dependencies

  • gcc
  • meson
  • ninja
  • nlohmann-json
  • opencv4

To build the library we start by running meson setup:

meson setup build -Dpython=false

Then to compile do

meson compile -C build

To install the package.

meson install

Testing

Under tests/ are some tests, these have only been actually tested on Qtechnology A/S cameras.

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

qamlib-0.11.0.tar.gz (77.7 kB view details)

Uploaded Source

Built Distributions

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

qamlib-0.11.0-cp313-cp313-manylinux_2_34_x86_64.whl (435.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

qamlib-0.11.0-cp312-cp312-manylinux_2_34_x86_64.whl (435.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

qamlib-0.11.0-cp311-cp311-manylinux_2_34_x86_64.whl (432.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

qamlib-0.11.0-cp310-cp310-manylinux_2_34_x86_64.whl (432.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

Details for the file qamlib-0.11.0.tar.gz.

File metadata

  • Download URL: qamlib-0.11.0.tar.gz
  • Upload date:
  • Size: 77.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for qamlib-0.11.0.tar.gz
Algorithm Hash digest
SHA256 b8c1c495dd7f363c9dbfa9ab5f077302e0dd058a15817ab349768bd55d15921f
MD5 10df6d0f86135551061e6210af9a8748
BLAKE2b-256 13f80a7db892eade742d3b435081dafec7212eec70de7fb61ec7f7fb1d30e13a

See more details on using hashes here.

File details

Details for the file qamlib-0.11.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qamlib-0.11.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b7a3d8ee8756d8aaeb81b7d4674adc57329503d6b2cb7449ecda067bfa8902ea
MD5 a26cabdebc9fc0a6931f84b9daadf94a
BLAKE2b-256 6a62aa32f04fdaf144214836bbcb2dd708e58824bebeb907a537e7e084693d19

See more details on using hashes here.

File details

Details for the file qamlib-0.11.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qamlib-0.11.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bb97716423ec4fb1335db51f143ee941c767196a5dc8d93a6a32858ce2bf638f
MD5 83108376c7766296d323e723f562e046
BLAKE2b-256 687920e2a4583d279ee432a79b9e68b22b2aab589b11e1863e06d6dd5ce23290

See more details on using hashes here.

File details

Details for the file qamlib-0.11.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qamlib-0.11.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9cb0f92d966673f9914d90a2061e5a6194398f6f8c8a00875f9be966931b489c
MD5 e0f02190ee989b94940787f09eeef4c2
BLAKE2b-256 8e5502ed257c2eb169b2c3a3c440175201ff9b577a9d281c7938b624167d5672

See more details on using hashes here.

File details

Details for the file qamlib-0.11.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qamlib-0.11.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8a99012e983ef1af2f4b96918300f96567e99bad6b040d97057ff1760521e0ab
MD5 3e2d1d37bc41b0b3fef48c489f69362c
BLAKE2b-256 ded03dcc1dccfd94bc1f62610631f5629c48111c5a2fa80784784b99ef6267ad

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