GPUStereo
Supported on:RVC4
GPUStereo is only supported on RVC4 devices and was added in DepthAI 3.7.1. You can guard runtime code with
device.isGpuStereoSupported().How to place it
dai.Device instance.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)Inputs and Outputs
disparityoutputs RAW16 disparity data.depthoutputs RAW16 depth data in the configured depth unit, millimeters by default.confidenceMapoutputs an 8-bit confidence map where lower values indicate lower-confidence matches.
Usage
3.7.1. initialConfig exposes confidenceThreshold, and you can disable internal rectification when providing already-rectified inputs.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 # If your inputs are already rectified, disable internal rectification.
15 # gpu.setRectification(False)
16
17 disp_q = gpu.disparity.createOutputQueue()
18 depth_q = gpu.depth.createOutputQueue()Reference
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
function
GPUStereo()function
function
GPUStereo & setRectification(bool enable)function
void buildInternal()Examples of functionality
- GPUStereo - Run GPU-accelerated stereo on RVC4 and visualize the disparity output.
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.