RealSense bindings for Rust
The project provides high-level bindings to librealsense2 library as well as low-level FFI interface. It supports asynchronous API and integration with image and nalgebra types.
Use this crate in your project
Make sure librealsense 2.39.0 is installed on your system. You may visit RealSense official repository.
Add this crate to your Cargo.toml
.
[]
= "0.5"
If you're using older librealsense for reasons. You may enable buildtime-bindgen
to re-generate bindings and good luck.
[]
= { = "0.5", = ["buildtime-bindgen"] }
Cargo Features
The crate enables with-nalgebra and with-image features by default.
- with-nalgebra (default): Enable nalgebra support.
- with-image (default): Enable image support.
- buildtime-bindgen: Generate Rust bindings during build time.
- device-test: Enable tests that requires connections to RealSense devices.
Get Started
You can start by Pipeline
. This is the minimal example to capture color and depth images.
use Result;
use ;
Examples
To capture image with your RealSense device,
cargo run --release --example capture_images
More examples can be found in examples directory.
Develop this project
Work with realsense-sys low-level API
The realsense-sys crate provides C bindings generated from librealsense headers. The reference can be found on RealSense official documentation.
Import realsense-sys to your Cargo.toml
.
[]
= "0.3"
and you can call low level C functions.
let pipeline = new?;
let = pipeline.into_raw_parts;
unsafe
Generate documents from source code
The API changes may not be found on docs.rs. To generate document from the most recent commit,
License
Apache 2.0. See LICENSE file.