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.7.3.tar.gz (76.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.7.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (382.4 kB view details)

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

qamlib-0.7.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (383.1 kB view details)

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

qamlib-0.7.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (380.5 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.7.3.tar.gz.

File metadata

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

File hashes

Hashes for qamlib-0.7.3.tar.gz
Algorithm Hash digest
SHA256 0bf9632a05be31645e92b03fb00f6fb9506e3b6dc34df68ce83262a286f241da
MD5 bdbd0479d9628ada67ec21c44492f547
BLAKE2b-256 73e4811793a3aa23069c225aac0c4e44a149e746219d92f4e55c235493b32ed3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.7.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f899aebe2fd3b4e086eb97e2a363e1a4820f878ff92c6a192d48d0a0316fe516
MD5 402315a5f3be5ef19043aba75fff8129
BLAKE2b-256 cbd8497c34e96f598299a3ec9cc950b4227e693f3ae068b43e5bbdc01a61ba38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.7.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8cbbc57fe33b8531d8bab83c6dc894a54765e89d232799d8098974264a6a5ce8
MD5 a0e77ee88aa5cab628e42ae3604e2d17
BLAKE2b-256 835dc6ef00d463682b9599eebfc76c7c4dbfcfc5a3df0b8a820bcc1aa639fcb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qamlib-0.7.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 68d466f760e8b07500edaa5006a1556ec6bb3b351b149faf6c396fc5b0ed3903
MD5 d9a12bdacca93c5c197e5c5bd0a37e1e
BLAKE2b-256 3f5c3c8ae30700e405df951ed59052c3800b363a751221f308104c93c0ecf49a

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