C/C++ Examples

Code Examples to start prototyping quickly:
These simple examples demonstrate how to easily use the SDK to include code snippets that access the camera into your applications.

List of RealSense SDK 2.0 Examples:

Name Language Description Experience Level Technology
[Hello-RealSense](/docs/rs-hello-realsense) C++ Demonstrates the basics of connecting to a RealSense device and using depth data :star: [![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-24.svg)](/docs/depth-samples)
[Distance](/docs/rs-distance) C Equivalent to

`hello-realsense`

but rewritten for C users

:star: [![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-25.svg)](/docs/depth-samples)
[Color](/docs/rs-color) C Demonstrate how to stream color data and prints some frame information :star: [![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-26.svg)](/docs/depth-samples)
[Capture](/docs/rs-capture) C++ Shows how to synchronize and render multiple streams: left, right, depth and RGB streams :star: [![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-27.svg)](/docs/depth-samples)

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-17.svg)](/docs/tracking-samples)

[Save To Disk](/docs/rs-save-to-disk) C++ Demonstrate how to render and save video streams on headless systems without graphical user interface (GUI) :star: [![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-28.svg)](/docs/depth-samples)

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-18.svg)](/docs/tracking-samples)

[Pointcloud](/docs/rs-pointcloud) C++ Showcase Projection API while generating and rendering 3D pointcloud :star: [![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-29.svg)](/docs/depth-samples)
[Pose](/docs/rs-pose) C++ Demonstrates how to obtain data from pose frames :star: [![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-19.svg)](/docs/tracking-samples)
[ImShow](/docs/rs-imshow) C++ &

[OpenCV](https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv#getting-started)

Minimal OpenCV application for visualizing depth data :star: [![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-30.svg)](/docs/depth-samples)
[Multicam](/docs/rs-multicam) C++ Present multiple cameras depth streams simultaneously, in separate windows :star: [![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-31.svg)](/docs/depth-samples)

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-20.svg)](/docs/tracking-samples)

[Depth](/docs/rs-depth) C Demonstrates how to stream depth data and prints a simple text-based representation of the depth image :star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-32.svg)](/docs/depth-samples)
[Spatial Alignment](/docs/rs-align) C++ Introduces the concept of spatial stream alignment, using depth-color mapping :star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-33.svg)](/docs/depth-samples)
[Advanced Alignment](/docs/rs-align-advanced) C++ Show a simple method for dynamic background removal from video :star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-34.svg)](/docs/depth-samples)
[Measure](/docs/rs-measure) C++ Lets the user measure the dimensions of 3D objects in a stream :star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-35.svg)](/docs/depth-samples)
[Post Processing](/docs/rs-post-processing) C++ Demonstrating usage of post processing filters for depth images :star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-36.svg)](/docs/depth-samples)
[Record & Playback](/docs/rs-record-playback) C++ Demonstrating usage of the recorder and playback devices :star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-37.svg)](/docs/depth-samples)
[Motion](/docs/rs-motion) C++ Demonstrates how to use data from gyroscope and accelerometer to compute the rotation of the camera :star:

:star:

[![Depth with IMU](https://dev.realsenseai.com/wp-content/uploads/2026/02/D435i-5bc3ff-2.svg)](/docs/depth-samples)

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-21.svg)](/docs/tracking-samples)

[Pose Prediction](/docs/rs-pose-predict) C++ Demonstrates how to use tracking camera asynchronously to implement simple pose prediction :star:

:star:

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-22.svg)](/docs/tracking-samples)
[Pose and Image](/docs/rs-pose-and-image) C++ Demonstrates how to use tracking camera asynchronously to obtain 200Hz poses and 30Hz images :star:

:star:

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-23.svg)](/docs/tracking-samples)
[AR-Basic](/docs/rs-ar-basic) C++ Shows how to use pose and fisheye frames to display a simple virtual object on the fisheye image :star:

:star:

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-24.svg)](/docs/tracking-samples)
[DNN](/docs/rs-dnn) C++ &

[OpenCV](https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv#getting-started)

RealSense camera used for real-time object-detection :star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-38.svg)](/docs/depth-samples)
[Trajectory](/docs/rs-trajectory) C++ Shows how to calculate and render 3D trajectory based on pose data from a tracking camera :star:

:star:

:star:

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-25.svg)](/docs/tracking-samples)
[Software Device](/docs/rs-software-device) C++ Shows how to create a custom

`rs2::device`

:star:

:star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-39.svg)](/docs/depth-samples)

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-26.svg)](/docs/tracking-samples)

[Sensor Control](/docs/rs-sensor-control) C++ A tutorial for using the

`rs2::sensor`

API

:star:

:star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-40.svg)](/docs/depth-samples)

[![Motion Tracking – T260 and SLAM](https://dev.realsenseai.com/wp-content/uploads/2026/02/Tracking-0e2356-27.svg)](/docs/tracking-samples)

[GrabCuts](/docs/rs-grabcuts) C++ &

[OpenCV](https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv#getting-started)

Simple background removal using the GrabCut algorithm :star:

:star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-41.svg)](/docs/depth-samples)
[Latency](/docs/rs-latency-tool) C++ &

[OpenCV](https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv#getting-started)

Basic latency estimation using computer vision :star:

:star:

:star:

[![Depth Sensing – Structured Light, Stereo](https://dev.realsenseai.com/wp-content/uploads/2026/02/Depth-5bc3ff-42.svg)](/docs/depth-samples)

Other Samples

Last Updated: February 2, 2026

Top
Contact Sales