librealsense2 API

File-System Structure

Under librealsense2 folder you will find two subfolers:

  • h - Contains headers for the C language

  • hpp - Contains headers for the C++ language, depends on C headers

In addition, you can include <librealsense2/rs.h> and <librealsense2/rs.hpp> to get most of SDK functionality in C and C++ respectively.

<librealsense2/rs_advanced_mode.h> and <librealsense2/rs_advanced_mode.hpp> can be included to get the extra Advanced Mode functionality (in C and C++ respectively).

<librealsense2/rsutil.h> contains mathematical helper functions for projection of 2D points into 3D space and back.

Files and Classes

For full up-to-date class documentation see Doxygen class-list

<a href=”librealsense2/hpp/rs_types.hpp” >rs_types.hpp</a>:

This file contains common functionality like the exception types. See Error Handling

Class

Description

error

Common base-class for all exceptions thrown from the SDK

recoverable_error

Base class for all recorverable (in software) errors

unrecoverable_error

Base class for non-recoverable errors

camera_disconnected_error

Camera Disconnected error

backend_error

Error from the underlying OS-specific driver

device_in_recovery_mode_error

Device requires firmware update

invalid_value_error

Invalid input was passed to a function

wrong_api_call_sequence_error

Methods were called in wrong order

not_implemented_error

Functionality is not available error

<a href=”librealsense2/hpp/rs_context.hpp” >rs_context.hpp</a>:

Context can be used to enumerate and iterate over connected device, and also get notifications of device events.

Class

Description

context

Context serve as a factory for all SDK devices

device_hub

Helper class that simplifies handling device change events

event_information

Information about device change

<a href=”librealsense2/hpp/rs_device.hpp” >rs_device.hpp</a>:

This file defines the concept of RealSense device.

Class

Description

device

Encapsulates Intel RealSense device

device_list

Wrapper around list of devices

debug_protocol

Debug-extension that allows to send data directly to the firmware

<a href=”librealsense2/hpp/rs_processing.hpp” >rs_processing.hpp</a>:

The SDK offers many types of post-processing in form of the Processing Blocks. These primitives can be pipelined using queues and configured using options.

Class

Description

syncer

Processing block that accepts frames one-by-one and outputs coherent framesets

frame_queue

Basic primitive abstracting a concurrent queue of frames

processing_block

Base class for frame processing functions

pointcloud

Processing block that accepts depth and texture frames and outputs 3D points with texture coordinates

asynchronous_syncer

Non-blocking version of the syncher processing block

align

Processing block that accepts frames from different viewports and generates new synthetic frames from a single given viewport

colorizer

Processing block that accepts depth frames in Z16 format and outputs depth frames in RGB format, applying some depth coloring

decimation_filter

Processing block that intelligently reduces the resolution of a depth frame

temporal_filter

Processing block that filters depth data by looking into previous frames

spatial_filter

Processing block that applies edge-preserving smoothing of depth data

<a href=”librealsense2/hpp/rs_sensor.hpp” >rs_sensor.hpp</a>:

RealSense devices contain sensors. Sensors are units of streaming, each sensor can be controlled individually.

Class

Description

sensor

Base class for all supported sensors

roi_sensor

Sensor that has the ability to focus on a given ROI

notification

Asynchronious message that can be passed to the application

depth_sensor

Sensor that can provide depth frames

<a href=”librealsense2/hpp/rs_frame.hpp” >rs_frame.hpp</a>:

The output of sensors are frames. There are different kinds of frames, not all video frames.

Class

Description

frame

Base class for all frames

points

Set of 3D points with texture coordinates

video_frame

2D image (with width, height and bpp)

depth_frame

Depth frame

frameset

A set of frames

stream_profile

Base class for sensor configuration

video_stream_profile

Video stream configuration

<a href=”librealsense2/hpp/rs_pipeline.hpp” >rs_pipeline.hpp</a>:

Pipeline is a high-level primitive combining several sensors and processing steps into one simple API.

Class

Description

pipeline

High level data-processor combining several sensors, queues and processing blocks

pipeline_profile

Selected pipeline configuration

config

Desired pipeline configuration

<a href=”librealsense2/hpp/rs_record_playback.hpp” >rs_record_playback.hpp</a>:

This file adds playback and record capability using ROS-bag files. See src/media

Class

Description

playback

Device that mimics live device from given input file

recorder

Device that records live device into an output file

<a href=”librealsense2\hpp\rs_internal.hpp” >rs_internal.hpp</a>:

This file is not intented to be included by SDK users, but rather is used in SDK unit-tests. It allows to record everything that will happen in a specific test into a file and later use that file for dependency injection.