Skip to main content

Python bindings for event camera utilities

Project description

evlib logo

evlib: Event Camera Data Processing Library

PyPI Version Python Versions Documentation Python Rust Platform License

An event camera processing library with a Rust backend and Python bindings, designed for scalable data processing with real-world event camera datasets.

Architecture

evlib keeps a thin Rust core and does all DataFrame work in Polars from Python:

  • Rust (evlib._evlib) handles only what cannot be expressed as DataFrame operations: binary format parsing (EVT2/EVT3/EVT2.1, AEDAT, AER, HDF5 with the ECF codec), construction of the Polars frame from decoded primitives, and the dense scatter-add that builds RVT stacked-histogram representations.
  • Python Polars handles all processing: loading filters, filtering (evlib.filtering), and representations (evlib.representations, evlib.rvt). Every query is a lazy Polars LazyFrame collected with a selectable engine, so the same code runs on the CPU streaming engine today and on the GPU via cudf-polars (collect(engine="gpu")) where CUDA is available.

evlib.load_events returns a LazyFrame and applies any time, spatial, or polarity filters as Polars expressions, so loading and filtering fuse into one GPU-collectable query.

Full documentation: https://tallamjr.github.io/evlib/

Quick Start

xkcd

What are Event Cameras?

Event cameras (also called neuromorphic or dynamic vision sensors) operate asynchronously: each pixel independently reports brightness changes as they occur, rather than sampling frames at a fixed rate.

Each event is represented as a 4-tuple:

$$e = (x, y, t, p)$$

Where:

  • $x, y \in \mathbb{N}$: Pixel coordinates
  • $t \in \mathbb{R}^+$: Timestamp (microsecond precision)
  • $p \in {-1, +1}$ or ${0, 1}$: Polarity (brightness change direction)

An event fires when the logarithmic brightness change exceeds a threshold:

$$\log(L(x,y,t)) - \log(L(x,y,t_{\text{last}})) > \pm C$$

where $C$ is the contrast threshold. This yields microsecond temporal resolution, 120 dB+ dynamic range, and data sparsity proportional to scene motion.

For a deeper introduction, see the user guide.

event data visualisation

Basic Usage

import evlib

# Automatic format detection — returns a Polars LazyFrame
events = evlib.load_events("data/prophesee/samples/evt2/80_balls.raw")

df = events.collect(engine="streaming")
print(f"Loaded {len(df):,} events")
print(f"Resolution: {df['x'].max()} x {df['y'].max()}")
print(f"Duration:   {df['t'].max() - df['t'].min()}")

Chain Polars expressions for efficient filtering and representation extraction:

import evlib
import evlib.representations as evr
import polars as pl

events = evlib.load_events("data/prophesee/samples/hdf5/pedestrians.hdf5")

# Temporal + spatial + polarity filtering, lazily
filtered = events.filter(
    (pl.col("t").dt.total_microseconds() / 1_000_000).is_between(0.1, 0.5)
    & pl.col("x").is_between(100, 500)
    & (pl.col("polarity") == 1)
)

# Produce a stacked histogram ready for an RVT-style model
hist = evr.create_stacked_histogram(
    filtered.collect(),
    height=180, width=240,
    bins=5, window_duration_ms=50.0,
)

See the representations guide for voxel grids, time surfaces, and mixed density stacks.

Installation

# Basic install
pip install evlib

# With PyTorch integration
pip install evlib[pytorch]

From source (requires Rust nightly and maturin):

git clone https://github.com/tallamjr/evlib.git
cd evlib
uv venv --python 3.12 && source .venv/bin/activate
uv pip install -e ".[dev]"
maturin develop                    # default minimal build
maturin develop --features hdf5    # opt-in HDF5 support (Linux/macOS)

HDF5 is opt-in on Linux/macOS and unavailable on Windows — use h5py directly for HDF5 I/O on Windows. Full details and platform-specific notes live in the installation guide.

Documentation

Complete documentation is published at https://tallamjr.github.io/evlib/:

Examples

Runnable examples live in examples/:

python examples/simple_example.py
python examples/filtering_demo.py
python examples/stacked_histogram_demo.py

# Jupyter notebooks
pytest --nbmake examples/

Benchmarks and performance scripts live in benches/.

Development

# Tests
pytest                        # Python
cargo test                    # Rust
pytest --markdown-docs docs/  # doc examples

# Formatting / linting
black python/ tests/ examples/
cargo fmt
ruff check python/ tests/
cargo clippy -- -D warnings

See CONTRIBUTING and the architecture overview for design details.

Community & Support

  • Issues: Report bugs and request features

xkcd

License

MIT License — see LICENSE.md for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

evlib-0.9.0-cp312-cp312-win_amd64.whl (17.5 MB view details)

Uploaded CPython 3.12Windows x86-64

evlib-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

evlib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl (14.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

evlib-0.9.0-cp311-cp311-win_amd64.whl (17.5 MB view details)

Uploaded CPython 3.11Windows x86-64

evlib-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

evlib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl (14.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

evlib-0.9.0-cp310-cp310-win_amd64.whl (17.5 MB view details)

Uploaded CPython 3.10Windows x86-64

evlib-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

evlib-0.9.0-cp310-cp310-macosx_11_0_arm64.whl (14.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file evlib-0.9.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: evlib-0.9.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 17.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for evlib-0.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3210d84cbb76beafc267d5fbb6fe208fcbd92e728a8b0fb29ea97637afc51105
MD5 056246c67be144a4a5f7b25db4b6ffd8
BLAKE2b-256 c7a61f8d8da91f95a59f6c126d467a1b5dc05fd0333eeca582631c2645960d26

See more details on using hashes here.

File details

Details for the file evlib-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for evlib-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5cbccc8a847801fa811128810ab3e7d63e6c3fa397889fa34600879451725884
MD5 accbe28befbb02dabc98867df7ade3bf
BLAKE2b-256 0406bc90faa3385553f8513ba8a0cc3499c9c13d25952ea3d1759a00077bea1e

See more details on using hashes here.

File details

Details for the file evlib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for evlib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 093c835bb38e403d5e015a505b67c39168c37f38b0ae7c56bfcce3a5dd0f8ed3
MD5 41a954600c90ac86cd635975a29c4676
BLAKE2b-256 628b18bfd718f8776a72091278c26fec123c23785cd620a40ffb91eb841bf4fc

See more details on using hashes here.

File details

Details for the file evlib-0.9.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: evlib-0.9.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 17.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for evlib-0.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 de16a3a4fdbc62f74ab6231daacb930716d9dc0307c86c1961d3ea4645391707
MD5 b746ffde7c0c821a14e3448cee8597c9
BLAKE2b-256 873ee436256edb2e36e919df78e5e9a7ae5a38f7881105e85262b36949587da9

See more details on using hashes here.

File details

Details for the file evlib-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for evlib-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7fa9bb7499f23dfba89857471ac52d6346adc3483e66fd320ed5e1783f561c6f
MD5 6b48a85e2b566adc833cc6cfc7687c87
BLAKE2b-256 f2ee5fdcca96e3efa63ad372fe5041cdf260ac373aab5127ac47bec21e5e9a0e

See more details on using hashes here.

File details

Details for the file evlib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for evlib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f46990a61e4c37387c05886eab1eba75db562124142ef5986038ac47f10588b4
MD5 e1ff0946b0b6de73803d78bc8860aecb
BLAKE2b-256 00bb62504638cb3075d676ac2124ea15a8af1479e4a9aa5426497ec1db1abf35

See more details on using hashes here.

File details

Details for the file evlib-0.9.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: evlib-0.9.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 17.5 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for evlib-0.9.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 19ebf0edd7cf9f508b09323eaa5d16a822ca99f687c1a4fc90440861fd92f5e1
MD5 5349d064dadfc6687811a72a59b461bd
BLAKE2b-256 63139f43233e8043d1ff4d985f333fb7b26f12b069ab16da06c63ac9e7ab1976

See more details on using hashes here.

File details

Details for the file evlib-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for evlib-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da080dca9f84ff84b4c6f288db6fe5883de3f92adc924be06189f8c804acad08
MD5 5541c1591ec009910be2c24ad785adc9
BLAKE2b-256 872ec00640a7fd0bdd2c5c230604acf8b143bc548779b69db081765be47768c0

See more details on using hashes here.

File details

Details for the file evlib-0.9.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for evlib-0.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 961829123a529b1847244acb17cbaeab6eaa264f8c9d2639e372f16bab7099b0
MD5 67512feb159cfd2623a0f169193fda1a
BLAKE2b-256 5dfcbe70bb52496b7240d536e1da72375e14407f46c4a4ad686d7d8597479e50

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