Crate realsense_rust[][src]

The crate provides high level API to librealsense2.

It features asynchronous API and integration with image and nalgebra.

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 anyhow::Result;
use realsense_rust::{Config, Format, Pipeline, StreamKind};

fn main() -> anyhow::Result<()> {
    let pipeline = Pipeline::new()?;
    let config = Config::new()?
        .enable_stream(StreamKind::Depth, 0, 640, 0, Format::Z16, 30)?
        .enable_stream(StreamKind::Color, 0, 640, 0, Format::Rgb8, 30)?;
    let mut pipeline = pipeline.start(config)?;

    let frames = pipeline.wait(None)?.unwrap();
    let color_frame = frames.color_frame()?.unwrap();
    let depth_frame = frames.depth_frame()?.unwrap();

    Ok(())
}

Re-exports

pub use base::Extrinsics;
pub use base::Intrinsics;
pub use base::MotionIntrinsics;
pub use base::PoseData;
pub use base::Resolution;
pub use base::StreamProfileData;
pub use config::Config;
pub use context::Context;
pub use device::Device;
pub use device_hub::DeviceHub;
pub use device_list::DeviceList;
pub use device_list::DeviceListIntoIter;
pub use error::Error;
pub use error::Result;
pub use frame::CompositeFrameIntoIter;
pub use frame::DepthFrame;
pub use frame::DepthFrameEx;
pub use frame::DisparityFrame;
pub use frame::DisparityFrameEx;
pub use frame::ExtendedFrame;
pub use frame::Frame;
pub use frame::GenericFrameEx;
pub use frame::VideoFrame;
pub use frame::VideoFrameEx;
pub use frame_queue::FrameQueue;
pub use kind::CameraInfo;
pub use kind::ColorScheme;
pub use kind::Extension;
pub use kind::Format;
pub use kind::FrameMetaDataValue;
pub use kind::HoleFillingMode;
pub use kind::PersistenceControl;
pub use kind::Rs2Option;
pub use kind::StreamKind;
pub use kind::TimestampDomain;
pub use options::OptionHandle;
pub use options::ToOptions;
pub use pipeline::ActivePipeline;
pub use pipeline::InactivePipeline;
pub use pipeline::Pipeline;
pub use pipeline_profile::PipelineProfile;
pub use processing_block::Align;
pub use processing_block::AnyProcessingBlock;
pub use processing_block::Colorizer;
pub use processing_block::DecimationFilter;
pub use processing_block::DisparityFilter;
pub use processing_block::HoleFillingFilter;
pub use processing_block::HuffmanDepthDecompress;
pub use processing_block::PointCloud;
pub use processing_block::ProcessingBlock;
pub use processing_block::RatesPrinter;
pub use processing_block::SpatialFilter;
pub use processing_block::Syncer;
pub use processing_block::TemporalFilter;
pub use processing_block::ThresholdFilter;
pub use processing_block::UnitsTransform;
pub use processing_block::YuyDecoder;
pub use processing_block::ZeroOrderFilter;
pub use processing_block_list::ProcessingBlockList;
pub use processing_block_list::ProcessingBlockListIntoIter;
pub use sensor::AnySensor;
pub use sensor::ColorSensor;
pub use sensor::DepthSensor;
pub use sensor::DepthStereoSensor;
pub use sensor::ExtendedSensor;
pub use sensor::FishEyeSensor;
pub use sensor::L500DepthSensor;
pub use sensor::MotionSensor;
pub use sensor::PoseSensor;
pub use sensor::Sensor;
pub use sensor::SoftwareSensor;
pub use sensor::Tm2Sensor;
pub use sensor_list::SensorList;
pub use sensor_list::SensorListIntoIter;
pub use stream_profile::AnyStreamProfile;
pub use stream_profile::MotionStreamProfile;
pub use stream_profile::PoseStreamProfile;
pub use stream_profile::StreamProfile;
pub use stream_profile::VideoStreamProfile;
pub use stream_profile_list::StreamProfileList;
pub use stream_profile_list::StreamProfileListIntoIter;

Modules

base

Common types and functions.

config

Configuration type for Pipeline.

context

Defines the sensor context.

device

Defines the device types.

device_hub

Defines the type of device hubs.

device_list

Defines the iterable list of devices.

error

Defines the error type used by the crate.

frame

Defines the frame type including sensor data.

frame_kind

Marker types and traits for Frame.

frame_queue

Defines the queue type of frames.

kind

Defines the common used enums.

options

Extension trait for runtime configuration.

pipeline

Defines the pipeline type.

pipeline_kind

Marker traits and types for Pipeline.

pipeline_profile

Defines the profile type of pipeline.

prelude

The mod collects common used traits from this crate.

processing_block

Defines the processing block type.

processing_block_kind

Marker traits and types for ProcessingBlock.

processing_block_list

Defines the iterable list of processing blocks.

sensor

Defines the sensor type.

sensor_kind

Marker traits and types for Sensor.

sensor_list

Defines the iterable list of sensors.

stream_profile

Defines the profile type of streams.

stream_profile_kind

Marker traits and types for StreamProfile.

stream_profile_list

Defines the iterable list of stream profiles.

Enums

Rs2Image

Image type returned by sensor.