RGBD
The RGBD node combines synchronized depth and color frames into a single point cloud and RGB-D data stream. It internally uses a Sync subnode to align depth (from a StereoDepth node) and color images for processing on the host.How to place it
Python
C++
Python
Python
1import depthai as dai
2
3with dai.Pipeline() as pipeline:
4 rgbd = pipeline.create(dai.node.RGBD)
5 # Link color and depth outputs to RGBD inputs
6 color.out.link(rgbd.inColor)
7 depth.out.link(rgbd.inDepth)
8
9 # Or use autocreate
10 rgbd = pipeline.create(dai.node.RGBD).build(
11 autocreate=True,
12 presetMode=dai.StereoDepth.PresetMode.DEFAULT,
13 size=(640, 400)
14 )
15 pipeline.start()
Inputs and Outputs
The Sync subnode aligns color and depth frames into a MessageGroup before processing.Configuration
build()
/build(autocreate, presetMode, size)
– Create the node, optionally autocreating color/depth nodes, selecting aStereoDepth::PresetMode
, and specifying frame size as(width, height)
.setDepthUnit(depthUnit)
– Choose the depth unit for conversion (e.g., millimeters or meters) viaStereoDepthConfig::AlgorithmControl::DepthUnit
.useCPU()
– Force single-threaded CPU processing (default).useCPUMT(numThreads)
– Enable multi-threaded CPU processing, specifyingnumThreads
(default:2
).useGPU(device)
– Offload processing to GPU (requires Kompute support), optionally specifying a GPU device index.printDevices()
– Print available GPU devices and capabilities.
Usage
Once placed and linked, start the pipeline and fetch outputs:Python
1with dai.Pipeline() as p:
2 qPcl = rgbd.pcl.createOutputQueue()
3 qRgbd = rgbd.rgbd.createOutputQueue()
4 pipeline.start()
5 pipeline.start()
6 pclData = qPcl.get() # type: dai.PointCloudData
7 rgbdData = qRgbd.get() # type: dai.RGBDData
Examples of functionality
- RGB-D Point Cloud Visualization (Rerun/Open3d/OAK Visualizer)
- RGB-D Point Cloud Visualization (Autocreate)
Reference
class
dai::node::RGBD
variable
Subnode< node::Sync > sync
variable
InputMap & inputs
variable
std::string colorInputName
variable
std::string depthInputName
variable
Input & inColor
variable
Input & inDepth
variable
Output pcl
Output point cloud.
variable
Output rgbd
function
RGBD()
function
~RGBD()
function
std::shared_ptr< RGBD > build()
function
std::shared_ptr< RGBD > build(bool autocreate, StereoDepth::PresetMode mode, std::pair< int, int > size)
function
void setDepthUnit(StereoDepthConfig::AlgorithmControl::DepthUnit depthUnit)
function
void useCPU()
function
void useCPUMT(uint32_t numThreads)
function
void useGPU(uint32_t device)
function
void printDevices()
function
void buildInternal()
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.