本页目录

  • 如何放置
  • 输入与输出
  • 配置
  • 使用
  • 功能示例
  • 参考

RGBD

Supported on:RVC2RVC4
RGBD节点将同步的深度帧和彩色帧合并为单个点云和RGB-D数据流。它在内部使用一个同步子节点,将深度(来自StereoDepth节点)和彩色图像对齐,以便在主机上进行处理。

如何放置

Python

Python
1import depthai as dai
2
3with dai.Pipeline() as pipeline:
4  rgbd = pipeline.create(dai.node.RGBD)
5  # 将彩色和深度输出连接到RGBD输入
6  color.out.link(rgbd.inColor)
7  depth.out.link(rgbd.inDepth)
8
9  # 或使用自动创建
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()

C++

C++
1#include <depthai/pipeline/Pipeline.hpp>
2#include <depthai/pipeline/node/host/RGBD.hpp>
3
4using namespace dai;
5
6Pipeline pipeline;
7auto rgbd = pipeline.create<node::RGBD>();
8// 将彩色和深度输出连接到RGBD输入
9color->out.link(rgbd->inColor);
10depth->out.link(rgbd->inDepth);
11
12// 或使用自动创建
13rgbd = pipeline.create<node::RGBD>().build(
14    autocreate=true,
15    presetMode=StereoDepth::PresetMode::DEFAULT,
16    std::pair<int, int> size = {640, 400}
17);

输入与输出

Sync子节点在处理前将彩色帧和深度帧对齐到MessageGroup中。

配置

  • build() / build(autocreate, presetMode, size) - 创建节点,可选择性自动创建彩色/深度节点,选择StereoDepth::PresetMode,并指定帧大小(宽度,高度)。
  • setDepthUnit(depthUnit) - 通过StereoDepthConfig::AlgorithmControl::DepthUnit选择深度单位(例如毫米或米)进行转换。
  • useCPU() - 强制使用单线程CPU处理(默认)。
  • useCPUMT(numThreads) - 启用多线程CPU处理,指定numThreads(默认值:2)。
  • useGPU(device) - 将处理卸载到GPU(需要Kompute支持),可选择指定GPU设备索引。
  • printDevices() - 打印可用的GPU设备和功能。

使用

放置并连接后,启动管线并获取输出:
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()   # 类型: dai.PointCloudData
7        rgbdData = qRgbd.get() # 类型: dai.RGBDData

功能示例

参考

class

dai::node::RGBD

#include RGBD.hpp
variable
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
Output RGBD frames.
function
RGBD()
function
~RGBD()
function
std::shared_ptr< RGBD > build()
function
std::shared_ptr< RGBD > build(bool autocreate, StereoDepth::PresetMode mode, const std::pair< int, int > & frameSize, std::optional< float > fps)
function
std::shared_ptr< RGBD > build(const std::shared_ptr< Camera > & camera, const DepthSource & depthSource, const std::pair< int, int > & frameSize, std::optional< float > fps)
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()

需要帮助?

请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。