EventCV¶
“OpenCV for event-based vision.” EventCV pairs a fast Rust core (eventcv-core) with
a NumPy-friendly Python API for loading, transforming, and representing event-camera data.
Read any common format —
.npz,.txt/.csv, ROS.bag,.hdf5,.aedat(AEDAT 2.0),.aedat4(iniVation DV), and Prophesee.dat/ EVT2 / EVT3.raw— through oneeventcv.load(). A DAVIS recording also yields its APS frames and IMU, not just its events, whether it arrives as a rosbag or as AEDAT:eventcv.read_frames(),eventcv.read_imu()andeventcv.read_camera_info()take a path or an open reader either way.Write every format it reads —
eventcv.save()is symmetric witheventcv.load(), and every event container can also be written a window at a time withEventSink, so a capture longer than memory streams to disk in whichever format the rest of your pipeline wants.Stream multi-gigabyte recordings without loading them whole via
eventcv.open(), with on-disk indexed slicing.Capture live from a USB event camera with
eventcv.stream()— representations per window, recording straight to disk, and hardware caps on the event rate.Transform streams with chainable, functional geometry / temporal / polarity ops.
Represent events as dense tensors (voxel grids, time surfaces, count images, …) ready for NumPy and PyTorch.
Detect features — corner detectors and the unsupervised, trainable
FEASTfeature extractor (the event analogue offeatures2d).Estimate motion — contrast maximisation to recover camera motion, and a tracker that follows objects across frames.
Augment for training with seeded, reproducible random ops that compose straight into a PyTorch
DataLoader.Visualise — colormapped frames, animated
.gif/.apng/.mp4export, and event-rate analytics.Run a model — feed a representation to any ONNX network with
Model.Simulate events from video with a v2e-grade sensor model — optionally with learned frame interpolation in front of it — and reconstruct intensity video back from events.
Move the heavy work to a GPU when it pays, with
device="gpu"oreventcv.set_device(). Off by default: the CPU implementations are the reference, and on a modern machine they win for everything but the simulator. See Representations.Call it your way — every operation is available both as a method (
stream.voxel()) and as an OpenCV-style free function (eventcv.voxel(stream)).
Contents
Installation¶
pip install eventcv
The wheel bundles its own libhdf5 and its own ONNX Runtime, so .h5/.hdf5 reading and
Model inference work with no extra installs. Writing .mp4 is the one thing
that expects something on your system — ffmpeg on your PATH; .gif and .apng need nothing.
Run eventcv --version to see which optional features a build has, and which ONNX Runtime it
found (where that comes from).
The Rust core’s API is documented separately on docs.rs.
What EventCV is not¶
A dataset library. N-MNIST, DVS-Gesture, N-Caltech101 and friends are
tonic’s job, and it does it well — auto-downloading, caching and
versioning roughly twenty standard datasets. EventCV reads files and builds tensors; point tonic at
a downloaded dataset and load its files with eventcv.load(), or use tonic end-to-end. There is
no value in a second, worse copy of that.
A model zoo. Model runs any ONNX graph you give it — including the
reconstruction networks in Reconstruction — but EventCV ships no
architectures and no weights. Bundling them would mean tracking every upstream model’s
preprocessing forever; building the tensors correctly is the part that belongs here.