# Depthai Examples

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.

### DepthAI nodes

 * [AprilTags](#Depthai%2520Examples-AprilTags)
 * [Camera](#Depthai%2520Examples-Camera)
 * [Benchmark](#Depthai%2520Examples-Benchmark)
 * [DetectionNetwork](#Depthai%2520Examples-DetectionNetwork)
 * [Feature Tracker](#Depthai%2520Examples-Feature%2520Tracker)

 * [Host Nodes](#Depthai%2520Examples-Host%2520Nodes)
 * [Image Align](#Depthai%2520Examples-Image%2520Align)
 * [Image Manip](#Depthai%2520Examples-Image%2520Manip)
 * [IMU](#Depthai%2520Examples-IMU)
 * [Neural Depth](#Depthai%2520Examples-Neural%2520Depth)
 * [Neural Network](#Depthai%2520Examples-Neural%2520Network)

 * [Stereo Depth](#Depthai%2520Examples-Stereo%2520Depth)
 * [SystemLogger](#Depthai%2520Examples-RVC2-specific%2520examples-SystemLogger)
 * [Video Encoder](#Depthai%2520Examples-Video%2520Encoder)
 * [Warp](#Depthai%2520Examples-Warp)
 * [Object Tracker](#Depthai%2520Examples-Object%2520Tracker)

More examples can be found in the [oak-examples (main
branch)](https://github.com/luxonis/oak-examples/tree/main?tab=readme-ov-file#oak-examples).

## AprilTags

 * [AprilTags](https://docs.luxonis.com/software-v3/depthai/examples/april_tags/april_tags.md) - Run AprilTag marker detection on
   a 1080P camera stream.
 * [AprilTags 12MP](https://docs.luxonis.com/software-v3/depthai/examples/april_tags/april_tags_12mp.md) - Run AprilTag marker
   detection on a 12MP camera stream.
 * [AprilTags on image replay](https://docs.luxonis.com/software-v3/depthai/examples/april_tags/april_tags_replay.md) - Run
   AprilTag marker detection on an image replay.

## Benchmark

 * [Benchmark Simple](https://docs.luxonis.com/software-v3/depthai/examples/benchmark/benchmark_simple.md) - Measure the latency
   of a pipeline.
 * [Benchmark Camera](https://docs.luxonis.com/software-v3/depthai/examples/benchmark/benchmark_camera.md) - Measure the FPS and
   the latency of a camera stream.
 * [Benchmark NN](https://docs.luxonis.com/software-v3/depthai/examples/benchmark/benchmark_nn.md) - Measure the FPS and the
   latency of a neural network model.

## Camera

 * [Display all cameras](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_all.md) - Display the highest
   resolution streams of all available camera sensors.
 * [Camera output](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_output.md) - Request an output stream from
   the default camera and display it.
 * [Camera multiple outputs](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_multiple_outputs.md) - Request
   multiple output streams from a single camera using command line arguments.
 * [Camera raw output](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_raw.md) - Get raw image data from
   camera and display it.
 * [Camera ROI-based exposure and
   focus](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_roi_exposure_focus.md) - Set auto-exposure and
   auto-focus based on a user-selected ROI.
 * [Camera still image at max resolution](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_still_max_res.md) -
   Capture a still image at the maximum resolution.
 * [Camera video max resolution](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_max_resolution.md) - Stream
   video at the maximum resolution.
 * [Camera high frame rate (HFR)](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_hfr.md) - Run OAK4 IMX586
   pipelines at 240/480 FPS, including neural inference and encoded streaming examples.
 * [Camera Undistort](https://docs.luxonis.com/software-v3/depthai/examples/camera/camera_undistort.md) - Undistort camera frames
   using intrinsic parameters.

## Calibration

 * [Calibration Dump](https://docs.luxonis.com/software-v3/depthai/examples/calibration/calibration_dump.md) - Dump the device
   calibration data.
 * [Calibration Load](https://docs.luxonis.com/software-v3/depthai/examples/calibration/calibration_load.md) - Load custom
   calibration data onto the device.
 * [Calibration Flash](https://docs.luxonis.com/software-v3/depthai/examples/calibration/calibration_flash.md) - Flash custom
   calibration data onto the device.
 * [Calibration Factory Reset](https://docs.luxonis.com/software-v3/depthai/examples/calibration/calibration_factory_reset.md) -
   Factory reset the device calibration data.

## DetectionNetwork

 * [Detection network](https://docs.luxonis.com/software-v3/depthai/examples/detection_network/detection_network.md) - Run a
   YOLOv6n object detection model and display results (bounding boxes) on a video stream.
 * [Detection network remap](https://docs.luxonis.com/software-v3/depthai/examples/detection_network/detection_network_remap.md) -
   Run a YOLOv6 object detection model and map the bounding boxes onto a depth frame.
 * [Detection network replay](https://docs.luxonis.com/software-v3/depthai/examples/detection_network/detection_network_replay.md)
   - Run a YOLOv6 object detection model on a replayed video stream, visualize detections in our custom-built visualizer.

## Events

 * [Events](https://docs.luxonis.com/software-v3/depthai/examples/events/events.md) - Handle events and set callbacks in DepthAI.

## Feature Tracker

 * [Feature tracker](https://docs.luxonis.com/software-v3/depthai/examples/feature_tracker/feature_tracker.md) - Detect features
   and track them between consecutive frames using optical flow.

## Host Nodes

 * [Display](https://docs.luxonis.com/software-v3/depthai/examples/host_nodes/display.md) - Create a custom host node that
   displays frames using OpenCV.
 * [Host Camera](https://docs.luxonis.com/software-v3/depthai/examples/host_nodes/host_camera.md) - Create a custom threaded host
   node to capture frames from the host machine's camera and send them to the pipeline.
 * [Threaded Host Nodes](https://docs.luxonis.com/software-v3/depthai/examples/host_nodes/threaded_host_nodes.md) - Create custom
   threaded host nodes and link them.

## Image Align

 * [Depth Align](https://docs.luxonis.com/software-v3/depthai/examples/image_align/depth_align.md) - Align and blend RGB and depth
   frames.

## Image Manip

 * [ImageManip all operations](https://docs.luxonis.com/software-v3/depthai/examples/image_manip/image_manip_all_ops.md) -
   Demonstrate various image manipulation operations including resizing (stretch/letterbox/crop), cropping, flipping, scaling,
   rotation, affine and perspective transforms, and frame type conversion.
 * [ImageManip multiple operations](https://docs.luxonis.com/software-v3/depthai/examples/image_manip/image_manip_multi_ops.md) -
   Define a sequence of operations to be applied to an input frame, all in a single ImageManip node.
 * [ImageManip resize](https://docs.luxonis.com/software-v3/depthai/examples/image_manip/image_manip_resize.md) - Resize frame and
   display both original and resized images.
 * [ImageManip remap](https://docs.luxonis.com/software-v3/depthai/examples/image_manip/image_manip_remap.md) - Use ImageManip to
   modify a frame and use the underlying transformation to remap a rectangle to match the modified frame.

## IMU

 * [IMU accelerometer and gyroscope](https://docs.luxonis.com/software-v3/depthai/examples/imu/imu_accelerometer_gyroscope.md) -
   Get accelerometer and gyroscope data from the IMU node

## Misc

 * [Device Information](https://docs.luxonis.com/software-v3/depthai/examples/misc/device_information.md) - Print device
   information such as name, serial number, and firmware version.
 * [Auto Reconnect](https://docs.luxonis.com/software-v3/depthai/examples/misc/auto_reconnect.md) - Demonstrates setting a
   reconnection callback and limited retry attempts on the device.
 * [Digital Zoom](https://docs.luxonis.com/software-v3/depthai/examples/misc/digital_zoom.md) - Crops and displays the largest
   detected person from the full-resolution RGB stream, and updates AE/AF regions to match the crop.
 * [Projectors](https://docs.luxonis.com/software-v3/depthai/examples/misc/projectors.md) - Control the dot projector and flood
   illuminator
 * [XLink Bridge](https://docs.luxonis.com/software-v3/depthai/examples/misc/xlink_bridge.md) - Access and tune the implicit XLink
   bridge for host-device streams.

## Neural Depth

 * [Neural Depth](https://docs.luxonis.com/software-v3/depthai/examples/neural_depth/neural_depth.md) - Run neural depth with
   runtime configuration controls.
 * [Neural Depth Minimal](https://docs.luxonis.com/software-v3/depthai/examples/neural_depth/neural_depth_minimal.md) - Basic
   neural depth disparity visualization.
 * [Neural Depth Align](https://docs.luxonis.com/software-v3/depthai/examples/neural_depth/neural_depth_align.md) - Align neural
   depth output to RGB camera.
 * [Neural Depth RGBD](https://docs.luxonis.com/software-v3/depthai/examples/neural_depth/neural_depth_rgbd.md) - Generate point
   cloud using neural depth and RGBD node.

## Neural Network

 * [Neural network](https://docs.luxonis.com/software-v3/depthai/examples/neural_network/neural_network.md) - Create a simple
   pipeline with a camera and neural network node.
 * [Neural network
   multi-input](https://docs.luxonis.com/software-v3/depthai/examples/neural_network/neural_network_multi_input.md) - Run a neural
   network model that concatenates a camera frame with a static image using two input tensors.
 * [Neural network multi-input
   combined](https://docs.luxonis.com/software-v3/depthai/examples/neural_network/neural_network_multi_input_combined.md) - Run a
   neural network model that combines two input images into a single output image.

## Object Tracker

 * [Object Tracker](https://docs.luxonis.com/software-v3/depthai/examples/object_tracker/object_tracker.md) - Track objects in 3D
   (XYZ in mm) using a YOLOv6 detector and the ObjectTracker node.
 * [Object Tracker Replay](https://docs.luxonis.com/software-v3/depthai/examples/object_tracker/object_tracker_replay.md) - Run
   object tracking on a replayed video file (or live camera), displaying track IDs and status (no XYZ).
 * [Object Tracker Remap](https://docs.luxonis.com/software-v3/depthai/examples/object_tracker/object_tracker_remap.md) - Track
   objects and remap bounding boxes onto a depth frame using transformation metadata for accurate alignment.

## Stereo Depth

 * [Stereo Depth](https://docs.luxonis.com/software-v3/depthai/examples/stereo_depth/stereo_depth.md) - Visualize disparity depth
   from stereo camera.
 * [Neural Assisted Stereo](https://docs.luxonis.com/software-v3/depthai/examples/stereo_depth/neural_assisted_stereo.md) - Fuse
   neural depth with classical stereo depth.
 * [Stereo Depth Remap](https://docs.luxonis.com/software-v3/depthai/examples/stereo_depth/stereo_depth_remap.md) - Remap geometry
   from disparity depth <frame> to color frame.
 * [Stereo Depth From Host](https://docs.luxonis.com/software-v3/depthai/examples/stereo_depth/stereo_depth_from_host.md) - Runs
   stereo disparity on-device using pre-rectified stereo images from the host.
 * [Stereo Depth Filters](https://docs.luxonis.com/software-v3/depthai/examples/stereo_depth/stereo_depth_filters.md) - Apply
   various filters to the stereo depth output.
 * [Stereo Depth Calibration
   Update](https://docs.luxonis.com/software-v3/depthai/examples/stereo_depth/stereo_depth_calibration_update.md) - Update stereo
   calibration parameters on-the-fly.

## Video Encoder

 * [Video Encode](https://docs.luxonis.com/software-v3/depthai/examples/video_encoder/video_encode.md) - Encode video frames
   on-device into MJPEG, H264, or H265 video codecs and save them to a file.

## Warp

 * [Warp mesh](https://docs.luxonis.com/software-v3/depthai/examples/warp/warp_mesh.md) - Warp the input image frame using a 3x3
   mesh transformation to create perspective distortion effects.

## Model Zoo

 * [Model Zoo](https://docs.luxonis.com/software-v3/depthai/examples/model_zoo/model_zoo.md) - Download a model from zoo and
   unpack it.

## RecordReplay

 * [Holistic Record](https://docs.luxonis.com/software-v3/depthai/examples/record_replay/holistic_record.md) - Record holistic
   pipeline data.
 * [Holistic Replay](https://docs.luxonis.com/software-v3/depthai/examples/record_replay/holistic_replay.md) - Replay recorded
   holistic pipeline data.
 * [Video Record](https://docs.luxonis.com/software-v3/depthai/examples/record_replay/record_video.md) - Record video streams.
 * [Video Replay](https://docs.luxonis.com/software-v3/depthai/examples/record_replay/replay_video.md) - Replay recorded video
   streams.

## RGBD

 * [RGBD Point Cloud Visualization](https://docs.luxonis.com/software-v3/depthai/examples/rgbd/rgbd.md) - Visualize colored point
   cloud data in three different visualizers.
 * [RGBD Point Cloud Visualization (Autocreate)](https://docs.luxonis.com/software-v3/depthai/examples/rgbd/rgbd_autocreate.md) -
   Create an RGBD node with autocreate and visualize colored point cloud data.

## Script

 * [Script Simple](https://docs.luxonis.com/software-v3/depthai/examples/script/script_simple.md) - Arguably the simplest script
   example ever.
 * [Script Switch All Cameras](https://docs.luxonis.com/software-v3/depthai/examples/script/script_switch_all_cameras.md) - Switch
   between all available cameras.

## SpatialDetectionNetwork

 * [Spatial Detection](https://docs.luxonis.com/software-v3/depthai/examples/spatial_detection_network/spatial_detection.md) - Run
   object detection with spatial (3D) coordinates

## SpatialLocationCalculator

 * [Spatial Location
   Calculator](https://docs.luxonis.com/software-v3/depthai/examples/spatial_location_calculator/spatial_location_calculator.md) -
   Calculate 3D spatial coordinates for specified points

## Sync

 * [Sync](https://docs.luxonis.com/software-v3/depthai/examples/sync/sync.md) - Synchronize two or more data streams.

## Visualizer

 * [Visualizer Encoded](https://docs.luxonis.com/software-v3/depthai/examples/visualizer/visualizer_encoded.md) - Visualize
   encoded streams.
 * [Visualizer YOLO](https://docs.luxonis.com/software-v3/depthai/examples/visualizer/visualizer_yolo.md) - Visualize YOLO
   detections.
 * [Custom Visualizations](https://docs.luxonis.com/software-v3/depthai/examples/visualizer/custom_visualizations.md) - Create
   custom visualizations and add them to the visualizer.
 * [Custom Services](https://docs.luxonis.com/software-v3/depthai/examples/visualizer/custom_services.md) - Define custom
   visualizer services and callbacks.

## RVC2-specific examples

Examples that are only supported on RVC2 platforms.

### EdgeDetector

 * [Edge Detector](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/edge_detector/edge_detector.md) - Detects edges on 3
   different inputs: left, right and RGB camera

### NNArchive

 * [NN Archive Superblob](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/nn_archive/nn_archive_superblob.md) -
   Download a superblob model from the zoo and run it.

### SystemLogger

 * [System Information](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/system_logger/system_information.md) - Displays
   device system information (memory/cpu usage, temperature).

### Thermal

 * [Thermal](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/thermal/thermal.md) - Display thermal camera feed with
   controls for brightness and shutter.
 * [Thermal Crosshair](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/thermal/thermal_crosshair.md) - Display thermal
   camera feed with temperature readout at mouse cursor position using crosshair overlay.

### ToF

 * [ToF](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/tof/tof.md) - Get depth frames from a ToF camera and visualize
   them using a colormap

### VSLAM

 * [Basalt VIO](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/vslam/basalt_vio.md) - VIO example using stereo cameras
   and the IMU to estimate the device's motion.
 * [Basalt VIO RTAB-Map SLAM](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/vslam/basalt_vio_rtab.md) - VSLAM example
 * [RTAB-Map VIO](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/vslam/rtab_map_vio.md) - Yet another VIO example.
 * [RTAB-MAP VIO SLAM](https://docs.luxonis.com/software-v3/depthai/examples/rvc2/vslam/rtab_map_vio_slam.md) - Yet another VSLAM
   example.
