| Crates.io | depthai |
| lib.rs | depthai |
| version | 0.1.2 |
| created_at | 2026-01-01 20:57:34.351745+00 |
| updated_at | 2026-01-21 23:32:58.684881+00 |
| description | Experimental Rust bindings and idiomatic wrapper for Luxonis DepthAI-Core v3. |
| homepage | https://github.com/groupe-carvi/depthai-rs |
| repository | https://github.com/groupe-carvi/depthai-rs |
| max_upload_size | |
| id | 2017501 |
| size | 412,978 |
depthai-rs is an unofficial binding in rust for the Luxonis's DepthAI-Core C++ library. Our goals at Carvi was to initially just do an experiment and see if it would be possible to create a safe bindings easily and quickly for our project by using agentic AI for lot of ffi boilerplates and resolution.
[!CAUTION] This project is experimental and in active development. APIs and behavior can change.
[!WARNING] DepthAI-Core itself does not provide strong API stability guarantees yet. This repo targets DepthAI-Core v3.1.0+ (supported tags: v3.1.0 / v3.2.0 / v3.2.1; default:
latest= v3.2.1).
depthai-systarget/dai-build/<tag>/...).depthai-sys/wrapper/wrapper.cpp) and generates Rust bindings using autocxx.depthaiDevice, Pipeline, typed camera helpers, and a generic node API.depthai-sys/ # FFI crate (build script + wrapper)
build.rs # clones/builds DepthAI-Core (Linux) or downloads prebuilt (Windows)
wrapper/ # C ABI functions used by Rust
src/ # Rust API (`Device`, `Pipeline`, nodes, camera helpers)
examples/ # runnable examples
tests/ # tests (some are ignored unless you enable hardware testing)
If youβre on another distro/OS, it may still work, but you may need to adjust packages and toolchain paths.
Install build tooling used by autocxx + CMake builds:
sudo apt -y install \
clang libclang-dev \
cmake ninja-build pkg-config \
python3 \
autoconf automake autoconf-archive libtool \
libudev-dev libssl-dev \
nasm \
libdw-dev libelf-dev
Optional (not required for core builds, but useful for local OpenCV tooling):
sudo apt -y install libopencv-dev
Some DepthAI devices require udev rules so you can access them without running as root.
If you hit permission errors (or see the device only under sudo), consult the official DepthAI/DepthAI-Core docs for the recommended udev rules for your device.
Install:
autocxx/libclang)Example (PowerShell):
winget install -e --id LLVM.LLVM
From the repo root:
cargo build
Notes:
target/dai-build/<tag>/....docs.rs builds are time-limited and often network-restricted. Building DepthAI-Core from source (or downloading large native artifacts) can time out.
To make documentation builds reliable, the top-level crate provides a docs feature which enables depthai-sys/no-native and:
autocxx to generate the Rust FFI API,On docs.rs specifically, the build also skips compiling the autocxx C++ glue to keep builds fast.
This mode is for docs only and is not runnable.
To build docs locally like docs.rs:
cargo doc -p depthai --no-default-features --features docscargo run --example pipeline_creation
cargo run --example camera
cargo run --example host_node
# Examples requiring the optional `rerun` feature
cargo run --features rerun --example rgbd_rerun
cargo run --features rerun --example video_encoder_rerun
cargo run --features rerun --example rerun_host_node
This table reflects what the Rust crates in this repo currently wrap and demonstrate via examples/ and tests/.
| DepthAI Feature | State | Rust evidence |
|---|---|---|
AprilTags |
π΄ | |
Benchmark |
π΄ | |
Camera |
π’ | examples/camera.rs |
DetectionNetwork |
π΄ | |
DynamicCalibration |
π΄ | |
Events |
π΄ | |
FeatureTracker |
π΄ | |
HostNodes |
π’ | examples/host_node.rs, examples/threaded_host_node.rs |
IMU |
π΄ | |
ImageAlign |
π’ | examples/rgbd_rerun.rs, src/image_align.rs |
ImageManip |
π’ | examples/image_manip.rs, src/image_manip.rs |
Misc/AutoReconnect |
π΄ | |
Misc/Projectors |
π‘ | Device::set_ir_laser_dot_projector_intensity |
ModelZoo |
π΄ | |
NeuralDepth |
π΄ | |
NeuralNetwork |
π΄ | |
ObjectTracker |
π΄ | |
RGBD |
π’ | examples/rgbd_rerun.rs, src/rgbd.rs |
RVC2/EdgeDetector |
π΄ | |
RVC2/ImageAlign |
π‘ | src/image_align.rs |
RVC2/NNArchive |
π΄ | |
RVC2/SystemLogger |
π΄ | |
RVC2/Thermal |
π΄ | |
RVC2/ToF |
π΄ | |
RVC2/VSLAM |
π΄ | |
RecordReplay |
π‘ | Pipeline::enable_holistic_record_json (no example yet) |
Script |
π΄ | |
SpatialDetectionNetwork |
π΄ | |
SpatialLocationCalculator |
π΄ | |
StereoDepth |
π’ | examples/rgbd_rerun.rs, src/stereo_depth.rs |
Sync |
π΄ | |
VideoEncoder |
π’ | examples/video_encoder.rs, src/video_encoder.rs |
Visualizer |
π΄ | |
Warp |
π΄ | |
utility |
π΄ |
depthai-sys exposes a few environment variables that affect native builds:
DEPTHAI_CORE_ROOT: override the DepthAI-Core checkout directory.DEPTHAI_SYS_LINK_SHARED=1: prefer linking against libdepthai-core.so (otherwise static is preferred).DEPTHAI_STAGE_RUNTIME_DEPS=0: disable automatic staging of runtime DLL/.so dependencies into target/<profile>/{,deps,examples}.DEPTHAI_OPENCV_SUPPORT=1: enable DepthAI-Core OpenCV support (if available).DEPTHAI_DYNAMIC_CALIBRATION_SUPPORT=1: toggle DepthAI-Core dynamic calibration support.DEPTHAI_ENABLE_EVENTS_MANAGER=1: toggle DepthAI-Core events manager.When using the depthai crate as a dependency in your own project on Linux, you need to ensure the runtime shared libraries can be found. The depthai-sys crate stages these libraries (like libdynamic_calibration.so, FFmpeg libraries, etc.) into your target/{debug,release}/ directory alongside your binary.
To enable your binary to find these libraries, add a build.rs file to your project with the following content:
fn main() {
if cfg!(target_os = "linux") {
// $ORIGIN makes the binary look for .so files in its own directory
println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN");
}
}
This sets the RPATH to $ORIGIN, which tells the dynamic linker to look for shared libraries in the same directory as your executable.
Alternatively, you can set LD_LIBRARY_PATH before running your binary, but using RPATH is more convenient for distribution.
This usually means another process already owns the device connection.
Pipeline::with_device(&device) so you donβt accidentally open two connections.Make sure clang and libclang-dev are installed on Linux, and that LLVM is installed on Windows.
By default, the build prefers static linking where possible. If you opt into shared linking (DEPTHAI_SYS_LINK_SHARED=1) you may need to ensure the runtime loader can find the shared libraries.
There is a hit feature flag intended for hardware integration testing:
cargo test --features hit
See LICENSE.