GPUStereo 仅在 RVC4 设备上受支持,并于 DepthAI 3.7.1 中添加。您可以使用
device.isGpuStereoSupported() 保护运行时代码。性能
如何放置它
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)输入和输出
disparity输出 RAW16 视差数据。depth输出配置深度单位的 RAW16 深度数据,默认为毫米。confidenceMap输出 8 位置信度图,其中较低的值表示较低置信度的匹配。
用法
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()参考
class
dai::node::GPUStereo
variable
variable
Subnode< MessageDemux > messageDemux
variable
std::unique_ptr< Subnode< Rectification > > rectification
variable
Input & left
variable
Input & right
variable
Input leftInternal
variable
Input rightInternal
variable
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 加速立体声并可视化视差输出。
需要帮助?
请访问讨论论坛以获取技术支持或您可能有的任何其他问题。