realsenseai/librealsense

RealSense SDK

What it is

RealSense SDK 2.0 (the librealsense library) is an open‑source, cross‑platform C++ SDK that talks to Intel RealSense depth cameras. It lets programs capture synchronized colour and depth streams, query camera intrinsics/extrinsics, and access higher‑level tools such as point‑cloud generation, depth quality measurement, and device configuration.

Why it matters

Depth perception is a core building block for robotics, 3‑D scanning, AR/VR, drones, and biometric applications. By providing a stable, well‑documented API (with wrappers for Python, C#, ROS 2, Unity, etc.) and supporting Windows, Linux, macOS, Android, Jetson and even AMD‑GPU acceleration, librealsense makes it easy for developers to add reliable 3‑D vision to their projects without writing low‑level driver code.

How to get started

  1. Pre‑compiled SDK – download the latest release bundle, plug in a RealSense camera, and run the included tools (RealSense Viewer, Depth Quality Tool).
  2. Build from source – clone the repo, run cmake .. and cmake --build . to compile the library for your platform. Detailed OS‑specific guides are linked in the README.
  3. Install the Python wrapper – pip install pyrealsense2 (stable) or pyrealsense2‑beta for the newest builds.

Example usage (C++ & Python)

#include <librealsense2/rs.hpp>
rs2::pipeline p; p.start();
while (true) {
    auto frames = p.wait_for_frames();
    auto depth = frames.get_depth_frame();
    float d = depth.get_distance(depth.get_width()/2, depth.get_height()/2);
    std::cout << "center distance: " << d << " m\r";
}
import pyrealsense2 as rs
pipe = rs.pipeline(); pipe.start()
while True:
    frames = pipe.wait_for_frames()
    depth = frames.get_depth_frame()
    w, h = depth.get_width(), depth.get_height()
    d = depth.get_distance(w//2, h//2)
    print(f"center distance: {d:.3f} m", end="\r")

Both snippets open a pipeline, fetch frames, and read the depth at the image centre.

Who should use it

  • Robotics engineers building navigation or manipulation systems that need real‑time depth.
  • Computer‑vision researchers needing calibrated colour‑depth data for 3‑D reconstruction or SLAM.
  • Developers of AR/VR, drones, or biometric systems that rely on accurate distance sensing.
  • Educators and hobbyists who want a ready‑to‑run SDK with examples in multiple languages.

The information above is taken directly from the repository’s README.

Related

  • Project
  • Project
  • Project
  • Project
  • Project