Neural Depth RGBD
Supported on:RVC4
Source code
Python
C++
Python
PythonGitHub
1import time
2import depthai as dai
3
4from argparse import ArgumentParser
5
6parser = ArgumentParser()
7parser.add_argument("--webSocketPort", type=int, default=8765)
8parser.add_argument("--httpPort", type=int, default=8080)
9args = parser.parse_args()
10
11FPS = 10
12with dai.Pipeline() as p:
13 remoteConnector = dai.RemoteConnection(
14 webSocketPort=args.webSocketPort, httpPort=args.httpPort
15 )
16 left = p.create(dai.node.Camera)
17 right = p.create(dai.node.Camera)
18 color = p.create(dai.node.Camera)
19 stereo = p.create(dai.node.NeuralDepth)
20 rgbd = p.create(dai.node.RGBD).build()
21 align = None
22
23 color.build(sensorFps=FPS)
24 left.build(dai.CameraBoardSocket.CAM_B, sensorFps=FPS)
25 right.build(dai.CameraBoardSocket.CAM_C, sensorFps=FPS)
26
27 # Linking
28 stereo.build(left.requestFullResolutionOutput(), right.requestFullResolutionOutput(), dai.DeviceModelZoo.NEURAL_DEPTH_LARGE)
29 out = color.requestOutput((1280, 800), dai.ImgFrame.Type.RGB888i, enableUndistortion=True)
30 align = p.create(dai.node.ImageAlign)
31 stereo.depth.link(align.input)
32 out.link(align.inputAlignTo)
33 align.outputAligned.link(rgbd.inDepth)
34 out.link(rgbd.inColor)
35 remoteConnector.addTopic("pcl", rgbd.pcl, "common")
36
37 p.start()
38 remoteConnector.registerPipeline(p)
39
40 while p.isRunning():
41 key = remoteConnector.waitKey(1)
42 if key == ord("q"):
43 print("Got q key from the remote connection!")
44 breakNeed assistance?
Head over to Discussion Forum for technical support or any other questions you might have.