Code Samples¶
Code samples are used for automated testing. They are also a great starting point for the DepthAI API, as different node functionalities are presented with code.
Bootloader
Bootloader Config - Read/Flash/Clear bootloader on the device
Bootloader Version - Retrieves Version of Bootloader on the device
Flash Bootloader - Flash factory bootloader to the device
Flash User Bootloader - Flash user bootloader to the device
POE set IP - Sets IP of the POE device
Calibration
Calibration Flash v5 - Flashes calibration data of version 5 (gen1 calibration data) to the device
Calibration Flash - Flashes calibration data of version 6 (gen2 calibration data) to the device
Calibration Reader - Reads calibration data stored on device over XLink
Calibration Load - Loads and uses calibration data of version 6 (gen2 calibration data) in a pipeline
Camera
Undistort camera stream - Showcases how Camera node undistorts camera streams
ColorCamera
Auto Exposure on ROI - Demonstrates how to use auto exposure based on the selected ROI
RGB Camera Control - Demonstrates how to control the RGB camera (crop, focus, exposure, sensitivity) from the host
RGB Preview - Displays a small preview of the RGB camera
RGB scene - Shows how to select ColorCamera’s scene and effect
RGB video - Displays high resolution frames of the RGB camera
Crash report
Crash report - In case of a firmware crash, example reads it from the device and saves it to a json file
EdgeDetector
Edge Detector - Performs edge detection on all camera streams
FeatureTracker
Feature Detector - Feature detection on input frame
Feature Tracker - Feature detection and tracking on input frame
Feature Tracker with Motion Estimation - Camera movement estimation based on feature tracking
Host side
Latency measurement - Measure frame latency from capturing to the host
OpenCV support - Demonstrates how to retrieve an image frame as an OpenCV frame
Device Queue Event - Demonstrates how to use device queue events
Queue add callback - Demonstrates how to use queue callbacks
ImageManip
RGB Rotate Warp - Demonstrates how to rotate, mirror, flip or perform perspective transform on a frame
ImageManip Tiling - Using ImageManip for frame tiling
ImageManip Rotate - Using ImageManip to rotate color/mono frames
IMU
IMU Accelerometer & Gyroscope - Accelerometer and gyroscope at 500hz rate
IMU Rotation Vector - Rotation vector at 400 hz rate
Mixed
Mono & MobilenetSSD & Depth - Runs MobileNetSSD on mono frames and displays detections on mono/disparity frames
Multiple devices - Run multiple OAK cameras from the same host computer
RGB Encoding & MobilenetSSD - Runs MobileNetSSD on RGB frames and encodes FUll-HD RGB into
.h265
and saves it on the hostRGB Encoding & Mono & MobilenetSSD - Runs MobileNetSSD on mono frames and displays detections on the frame + encodes RGB to
.h265
RGB Encoding & Mono with MobilenetSSD & Depth - A combination of RGB Encoding and Mono & MobilenetSSD & Depth code samples
Spatial detections on rotated OAK - Spatail detections on upside down OAK camera
Collision avoidance - Collision avoidance system using depth and RGB
MobileNet
Mono & MobilenetSSD - Runs MobileNetSSD on mono frames and displays detections on the frame
Video & MobilenetSSD - Runs MobileNetSSD on the video from the host
RGB & MobilenetSSD - Runs MobileNetSSD on RGB frames and displays detections on the frame
RGB & MobileNetSSD @ 4K - Runs MobileNetSSD on RGB frames and displays detections on both preview and 4k frames
MonoCamera
Mono Preview - Displays right/left mono cameras
Mono Camera Control - Demonstrates how to control the mono camera (crop, exposure, sensitivity) from the host
Mono preview - Alternate between dot projector and illumination LED on OAK Pro devices
Mono Full Resolution Saver - Saves mono (720P) images to the host (
.png
)
NeuralNetwork
Multi-Input Frame Concat - Concat mono/rgb streams on the device with a custom model
Frame Normalization - Normalize the frame on the device with a custom model
ObjectTracker
Object tracker on video - Performs object tracking from the video
Object tracker on RGB - Performs object tracking from the RGB camera
Spatial object tracker on RGB - Performs object tracking and also provides spatial coordinates
Script
Script camera control - Controlling the camera with the Script node
Script change pipeline flow - Change the flow of data inside your pipeline in runtime with Script node
Script forward frames - Forward incoming image stream to two different output streams (demuxing)
Script get local IP - Get local IP of the device (only OAK-POE devices)
Script HTTP client - Send HTTP request to a server (only OAK-POE devices)
Script JSON communication - 2-way JSON communication between Script <-> Host
Script HTTP server - Serve still image over HTTP response (only OAK-POE devices)
Script MJPEG server - Serve MJPEG video stream over HTTP response (only OAK-POE devices)
Script NNData example - Constructs NNData in Script node and sends it to the host
Script UART communication - UART communication with Script node
Script EMMC access - Access EMMC memory from the Script node
SpatialDetection
Spatial Calculator Multi-ROI - Selects multiple ROIs and calculates spatial coordinates for each of them
Spatial location calculator - Demonstrates how to use the spatial location calculator
RGB & MobilenetSSD with spatial data - Displays RGB frames with MobileNet detections and spatial coordinates on them
Mono & MobilenetSSD with spatial data - Displays mono frames with MobileNet detections and spatial coordinates on them
RGB & TinyYolo with spatial data- Displays RGB frames with Yolo detections and spatial coordinates on them
StereoDepth
Depth Crop Control - Demonstrates how to control cropping of depth frames from the host
Depth Post-Processing - Depth post-processing filters
Depth Preview - Displays colorized stereo disparity
Stereo Depth custom Mesh - Calculate and load custom mesh for stereo depth calculation
Stereo Depth from host - Generates stereo depth frame from a set of mono images from the host
Stereo Depth Video - An extended version of Depth Preview
RGB Depth alignment - Displays RGB depth aligned frames
PointCloud
PointCloud Visualization - Creates point cloud from depth frames and displays it using Open3D
PointCloud Control - Demonstrates how to control point cloud from the host
Sync Node
Depth and Video Sync - Synchronizes depth and video streams for real-time processing and display.
IMU and Video Sync - Aligns IMU data with video frames, showcasing real-time rotation vector display alongside video.
Multiple Scripts Sync - Demonstrates synchronization of data from two script nodes emitting data at different intervals.
Demuxing Synchronized Script Outputs - Features synchronization of script outputs followed by demultiplexing for distinct processing streams.
SystemLogger
System information - Displays device system information (memory/cpu usage, temperature)
ToF
ToF depth - Displays colorized ToF depth frames
VideoEncoder
Disparity encoding - Encodes stereo disparity into
.mjpeg
RGB Encoding - Encodes RGB (1080P, 30FPS) into
.h265
and saves it on the hostRGB & Mono Encoding- Encodes RGB (1080P, 30FPS) and both mono streams (720P, 30FPS) into
.h265
/.h264
and saves them on the hostEncoding Max Limit - Encodes RGB (4k 25FPS) and both mono streams (720P, 25FPS) into
.h265
/.h264
and saves them on the hostRGB Full Resolution Saver - Saves full resolution RGB images (4k) on the host (
.jpeg
)Video Encoded Frame Type - Demonstrates how to view frame type when using video encoding
Warp
Warp Mesh - Displays an image warped with 2 different meshes
Interactive Warp Mesh - Interactively change the warp mesh
UVC
UVC & Color Camera - Displays RGB frames from a UVC camera
UVC & Mono Camera - Displays mono frames from a UVC camera
UVC & Disparity - Displays disparity frames from a UVC camera
Yolo
RGB & Tiny YOLO - Runs Tiny YOLO on RGB frames and displays detections on the frame