Code Samples

The ZED SDK comes with multiple code examples to help you get started with spatial perception and AI. You can find the samples on Stereolabs GitHub.

Samples

Sample Description Link
Camera Control Shows how camera settings like Exposure, Gain, Contrast, Sharpness, etc. can be modified and display the resulting image. C++
Python
Camera Streaming Shows how to stream the ZED stereo video on IP network, decode the video and display its live 3D point cloud. C++
Python
Depth Sensing Shows how to capture a 3D point cloud and display it in an OpenGL window. C++ Python
Positional Tracking Displays the live position and orientation of the camera in a 3D window. C++
Python
Spatial Object Detection 2D Display Detect and track objects in the scene, and display their 3D bounding boxes over the live image. C++ Python
Spatial Object Detection 3D Display Detect and track objects in the scene, and display their 3D bounding boxes over the live point cloud. C++ Python
Body Tracking Shows how to detect and track 3D human bodies in space and display skeletons over the live image. C++
Python
Spatial Mapping Captures a live 3D mesh of the environment and displays it as an overlay on the camera image. C++ Python
Plane Detection Shows how to detect floor and planar areas in the scene and draw them on the image. C++ Python
Video Recording Shows how to record a lossless or compressed video in SVO format. C++
Python
Video Playback Shows how to playback a recorded SVO video. C++
Python
Video Export Opens an SVO file and exports video and depth to PNG or AVI files. C++
Python
Multi Camera Shows how to open and use multiple ZED cameras at the same time in a single application. C++
Python

Tutorials

Tutorial Description Link
Hello ZED This is the simplest tutorial. It shows how to open a stereo camera and print its serial number in the terminal. C++
Python
Image Capture Shows how to open a stereo camera, capture an image and print its timestamp and image size in the terminal. C++
Python
Depth Perception Shows how to retrieve depth and point cloud of a scene, and print the distance of a given point in the terminal. C++
Python
Camera Tracking Shows how to enable positional tracking and get the position and orientation of the camera in real-time. C++
Python
Spatial Mapping Shows how to enable spatial mapping and capture a mesh or fused point cloud of the environment. C++
Python
3D Object Detection Shows how to detect objects in a scene and localize them in 3D (ZED 2 only). C++
Python
Using Sensors Shows how to acquire IMU, barometer and magnetometer data. C++
Python

Integrations

Integration Description Links
ZED OpenCV Shows how to capture image, depth and point cloud and convert them to OpenCV format. GitHub
ZED ROS Provides access to ZED data through ROS topics and services. GitHub (ROS)
GitHub (ROS2)
ZED PyTorch Uses ZED SDK and PyTorch to detect, segment, classify and locate objects in 3D. GitHub
ZED TensorFlow Uses ZED SDK and TensorFlow to detect, classify and locate objects in 3D. GitHub
ZED Yolo Uses ZED SDK and YOLO object detection to display the 3D location of objects and people in a scene. GitHub
ZED Docker Shows how to run the ZED SDK in a Docker container. GitHub DockerHub
ZED Unity Plugin Provides access to ZED SDK features in Unity. GitHub
ZED UE5 Plugin Provides access to ZED SDK features in Unreal Engine 5. GitHub
ZED UE4 Plugin Provides access to ZED SDK features in Unreal Engine 4. GitHub
ZED GStreamer Plugins to use the ZED and its SDK in a GStreamer pipeline. GitHub
ZED Matlab Allows to use the ZED and its SDK in Matlab. GitHub
ZED OpenPose Uses ZED SDK and OpenPose skeleton detection to display real-time multi-person 3D pose of human bodies. GitHub
CUDA Interoperability Creates an out-of-focus (bokeh) effect on the camera stream using the depth and a CUDA kernel. GitHub
ZED OpenGL Shows how to use GPU memory to display camera images and depth using OpenGL. GitHub
ZED Aruco Shows how to track or relocalize the position of one or multiple cameras using an Aruco marker. GitHub
ZED PCL Shows how to acquire and display a 3D point cloud with PCL (Point Cloud Library). GitHub
ZED OpenNI2 OpenNI2 driver for the ZED stereo camera family. GitHub