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.9.0.tar.gz (77.0 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.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (400.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

qamlib-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (399.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

qamlib-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (398.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

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

File metadata

  • Download URL: qamlib-0.9.0.tar.gz
  • Upload date:
  • Size: 77.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for qamlib-0.9.0.tar.gz
Algorithm Hash digest
SHA256 9e1b81d4e551bd852b02080d6c13835ab29a2824c7de6bd9632eb58c89f20023
MD5 9c5b6a6e7894073056d6200110869c07
BLAKE2b-256 510c192b1653dde1e62121e5cf5ef19355937c6af312a21666ed5d86dd5e2633

See more details on using hashes here.

File details

Details for the file qamlib-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qamlib-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f0ca4f7ab152c2c64616051f6aa145b084ab8339418ff167d037abe1c72e951a
MD5 9df6a0a766cf0aca787b638dc9df1920
BLAKE2b-256 02803149143b9ccf1f6d787723653d59debf653e4c2e3a89a89e614989272c5c

See more details on using hashes here.

File details

Details for the file qamlib-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qamlib-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88f3c017a3fb77521fbe77467cfb58927d3bd3d9cb05644f06c073b9dd4ffd8e
MD5 0d04d6f4bfd50e607fd173d5721eb059
BLAKE2b-256 2843bc8d063bca27083805d1a815637b9353abfec5234c26dead7b7148ee025a

See more details on using hashes here.

File details

Details for the file qamlib-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qamlib-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2b7acd464364e91cb04b70051b138a5d422af80a6f44cce16e57de01a3054546
MD5 eff1176d663f68006e6d2622936da8d6
BLAKE2b-256 133bbcaa182d31600df59d21975e403c4f6a2ac2d5ab39f7993900bcbe53d208

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