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.10.0.tar.gz (78.1 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.10.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.10.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.10.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.10.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.10.0.tar.gz.

File metadata

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

File hashes

Hashes for qamlib-0.10.0.tar.gz
Algorithm Hash digest
SHA256 67e94d790f86d0135e6a5f34d89518e1fd22bbd5a608f184dcef6708edf5439d
MD5 1f242b2cad68ebcadf83f7ea1cecc640
BLAKE2b-256 51dd476063f3d5250e4808ecc59a8c4c1c796def58d1bef2ad791cabc69b402d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.10.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e87cc84f0539c851eb4b6f826e5a9ad72049c50ad1978d46cccc0e4918c36a81
MD5 4a2e05b5488c6f4bb8d671306a2d8613
BLAKE2b-256 22a339cee1433adac6f47a346d50784d9b7f30fe256f9de39c900e8e6c0e5e6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.10.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 570d16e9b66a8d15df8118bd1cb85f4a003eed3da99e245a87e19e8346a5f464
MD5 04f0e6c13f040a53601288e5391c4e58
BLAKE2b-256 46aa05e73273d7011a510116e2650ee87c13429824988998de55625ec5bd79e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.10.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ef4dbe78b830f7d6a34182d689f6e34ab987e8d7ec4551b4c2c75b3e9e36365f
MD5 d640698e6e929e4f9c6323478243d3ce
BLAKE2b-256 28e27920da1804af11c13c57f9e6d93b254be239123b542800aef8b356e78ae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.10.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1467e45c7c4e7c0d61d2f69d95f9b5b83cb3f00c84b4256ca775ab29f36cddc4
MD5 8fe5a45e49959a561a7a2fb7342de782
BLAKE2b-256 2b322a68b73ce7cba13bd74a4f97c070afe5decd8f49721bd86d13373a1508c3

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