此页面由 AI 自动翻译。查看英文原版
最后更新

本页目录

  • 如何放置
  • 输入和输出
  • 配置
  • 用法
  • 功能示例
  • 参考
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包
最后更新
Supported on:RVC2RVC4
RGBD 节点将同步的深度和彩色帧组合成单个点云和 RGB-D 数据流。它内部使用一个 Sync 子节点来对齐深度(来自 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  # 或者使用 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()

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// 或者使用 autocreate
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,并指定帧大小为 (width, height)。
  • 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)
Build RGBD node with specified size. Note that this API is global and if used autocreated cameras can't be reused.
Parameters
  • autocreate: If true, will create color and depth nodes if they don't exist.
  • frameSize: Size of the frames
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)
Build RGBD node with camera and depth source node.
Parameters
function
void setDepthUnit(StereoDepthConfig::AlgorithmControl::DepthUnit depthUnit)
function
void useCPU()
Use single-threaded CPU for processing.
function
void useCPUMT(uint32_t numThreads)
Use multi-threaded CPU for processing.
Parameters
  • numThreads: Number of threads to use
function
void useGPU(uint32_t device)
Use GPU for processing (needs to be compiled with Kompute support)
Parameters
  • device: GPU device index
function
void printDevices()
Print available GPU devices.
function
void buildInternal()

需要帮助?

请访问讨论论坛以获取技术支持或您可能有的任何其他问题。