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++

Dependicies

  • gcc
  • meson
  • ninja
  • nlohmann-json

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.8.0.tar.gz (75.5 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.8.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.3 kB view details)

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

qamlib-0.8.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (391.5 kB view details)

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

qamlib-0.8.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (387.8 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.8.0.tar.gz.

File metadata

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

File hashes

Hashes for qamlib-0.8.0.tar.gz
Algorithm Hash digest
SHA256 821a5b568ed1d81b4b8751b50e6fbb67f866c1ce7e2ca6ff4bbe4499c59147ce
MD5 e878106c5bfb2514d5691e4767cea513
BLAKE2b-256 0ca55d58a596c67cb8b5a48a33fb933540401c638eae96d9957b9645746eb26b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.8.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ac2c8f84e5bd68c1fa3c21ad2ac1cc0237f032e03bb84838f46b3bd7ff0e682
MD5 acfe1f8a7990dc0fe2e1cd0fb523e956
BLAKE2b-256 e6ee87aad7426feea172abc0bc428df95a314f269d50ee8cbf465c245dc6b54d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.8.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2157344aed0bcc0bb32f55d54b27e01e3033943bc447f8a52a844bc13ee63cda
MD5 8994a89480720d492203de7730a78b1b
BLAKE2b-256 90904939a92aab1de58cf9a40552eb1b8ff44f5fee6789187818844a47b91697

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.8.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 83a5586b0c604306ab790664ab084090864d7532cf03be59fee97062db348306
MD5 4199397274b00a4223d78223e2d984aa
BLAKE2b-256 e06b4969d87027ebde03b2006b28ddf6936c9764d3d80a3986d3ffdaf36e2da1

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