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

本页目录

  • 性能
  • 如何放置它
  • 输入和输出
  • 用法
  • 参考
  • 功能示例
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包
最后更新
Supported on:RVC4
GPUStereo 在 RVC4 GPU 上从同步立体对计算视差和深度。它接受实时摄像头输出或已校正的帧,默认启用内置校正。

性能

有关详细的 FPS 和延迟基准,请参阅 深度概述 – GPU 立体性能。

如何放置它

GPUStereo 是一个设备节点,因此请使用 dai.Device 实例创建管道。

Python

Python
1import depthai as dai
2
3device = dai.Device()
4if not device.isGpuStereoSupported():
5    raise RuntimeError("GPUStereo is not supported on this device.")
6
7with dai.Pipeline(device) as pipeline:
8    cam_left = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
9    cam_right = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
10
11    gpu = pipeline.create(dai.node.GPUStereo)
12    cam_left.requestFullResolutionOutput().link(gpu.left)
13    cam_right.requestFullResolutionOutput().link(gpu.right)

C++

C++
1#include <depthai/depthai.hpp>
2
3auto device = std::make_shared<dai::Device>();
4if(!device->isGpuStereoSupported()) {
5    throw std::runtime_error("GPUStereo is not supported on this device.");
6}
7
8dai::Pipeline pipeline(device);
9auto camLeft = pipeline.create<dai::node::Camera>();
10auto camRight = pipeline.create<dai::node::Camera>();
11camLeft->build(dai::CameraBoardSocket::CAM_B);
12camRight->build(dai::CameraBoardSocket::CAM_C);
13
14auto gpu = pipeline.create<dai::node::GPUStereo>();
15camLeft->requestFullResolutionOutput()->link(gpu->left);
16camRight->requestFullResolutionOutput()->link(gpu->right);

输入和输出

  • disparity 输出 RAW16 视差数据。
  • depth 输出配置深度单位的 RAW16 深度数据,默认为毫米。
  • confidenceMap 输出 8 位置信度图,其中较低的值表示较低置信度的匹配。

用法

GPUStereo 的公共启动配置在 3.7.1 中有意地很小。initialConfig 暴露了 confidenceThreshold,您可以在提供已校正输入时禁用内部校正。

Python

Python
1import depthai as dai
2
3device = dai.Device()
4
5with dai.Pipeline(device) as pipeline:
6    cam_left = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
7    cam_right = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
8
9    gpu = pipeline.create(dai.node.GPUStereo)
10    cam_left.requestFullResolutionOutput().link(gpu.left)
11    cam_right.requestFullResolutionOutput().link(gpu.right)
12
13    gpu.initialConfig.setConfidenceThreshold(25)
14    # 如果您的输入已校正,请禁用内部校正。
15    # gpu.setRectification(False)
16
17    disp_q = gpu.disparity.createOutputQueue()
18    depth_q = gpu.depth.createOutputQueue()

C++

C++
1#include <depthai/depthai.hpp>
2
3auto device = std::make_shared<dai::Device>();
4dai::Pipeline pipeline(device);
5
6auto camLeft = pipeline.create<dai::node::Camera>();
7auto camRight = pipeline.create<dai::node::Camera>();
8camLeft->build(dai::CameraBoardSocket::CAM_B);
9camRight->build(dai::CameraBoardSocket::CAM_C);
10
11auto gpu = pipeline.create<dai::node::GPUStereo>();
12camLeft->requestFullResolutionOutput()->link(gpu->left);
13camRight->requestFullResolutionOutput()->link(gpu->right);
14
15gpu->initialConfig->setConfidenceThreshold(25);
16// 如果您的输入已校正,请禁用内部校正。
17// gpu->setRectification(false);
18
19auto dispQ = gpu->disparity.createOutputQueue();
20auto depthQ = gpu->depth.createOutputQueue();

参考

class

dai::node::GPUStereo

#include GPUStereo.hpp
variable
Subnode< Sync > sync
variable
Subnode< MessageDemux > messageDemux
variable
std::unique_ptr< Subnode< Rectification > > rectification
variable
Input & left
variable
Input & right
variable
Input leftInternal
variable
Input rightInternal
variable
Output disparity
Outputs ImgFrame message that carries RAW16 encoded disparity data.
variable
Output depth
Outputs ImgFrame message that carries RAW16 encoded (0..65535) depth data in depth units (millimeter by default).Non-determined / invalid depth values are set to 0
variable
Output confidenceMap
Outputs ImgFrame message that carries RAW8 confidence map. Lower values mean lower confidence of the calculated disparity value. Note: postprocessing steps like LR-check/median filter are not applied to confidence map.
variable
std::shared_ptr< GPUStereoConfig > initialConfig
Initial config to use for GPUStereo.Use this to configure startup parameters before the pipeline starts. Note: Only confidenceThreshold is supported/exposed for this node.
function
GPUStereo()
function
std::shared_ptr< GPUStereo > build(Output & left, Output & right)
Build the node by linking left and right camera outputs.
function
GPUStereo & setRectification(bool enable)
Enable or disable built-in stereo rectification. When enabled, the node rectifies the input images internally using calibration data. When disabled, inputs are expected to be already rectified.
function
void buildInternal()
Function called from within the create function to build the node. This function is useful for initialization, setting up inputs and outputs = stuff that cannot be perform in the constuctor.

功能示例

  • GPUStereo - 在 RVC4 上运行 GPU 加速立体声并可视化视差输出。

需要帮助?

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