http://localhost:8082 上的 DepthAI 可视化工具。有关运行时滤波器调整和附加点云工作流程,请参阅 ToF 点云 + 运行时调整 (oak-examples)。此示例需要 DepthAI v3 API,请参阅 安装说明。
源代码
Python
PythonGitHub
1#!/usr/bin/env python3
2"""ToF colorized point cloud streamed to the DepthAI Visualizer.
3
4Open http://localhost:8082 in a browser after starting this script.
5"""
6
7import depthai as dai
8
9FPS = 30.0
10SIZE = (640, 400)
11
12with dai.Pipeline() as p:
13 device = p.getDefaultDevice()
14
15 if device.getPlatform() == dai.Platform.RVC2:
16 RGB_SOCKET = dai.CameraBoardSocket.CAM_C
17 else:
18 RGB_SOCKET = dai.CameraBoardSocket.CAM_A
19
20 color = p.create(dai.node.Camera).build(RGB_SOCKET, sensorFps=FPS)
21 colorOut = color.requestOutput(SIZE, fps=FPS, type=dai.ImgFrame.Type.RGB888i, enableUndistortion=True)
22
23 tof = p.create(dai.node.ToF)
24 tof.build(
25 boardSocket=dai.CameraBoardSocket.AUTO,
26 presetMode=dai.ImageFiltersPresetMode.TOF_HIGH_RANGE,
27 fps=FPS
28 )
29
30 align = p.create(dai.node.ImageAlign)
31 align.setRunOnHost(True)
32 tof.depth.link(align.input)
33 colorOut.link(align.inputAlignTo)
34
35 pc = p.create(dai.node.PointCloud)
36 pc.initialConfig.setLengthUnit(dai.LengthUnit.MILLIMETER)
37 pc.setTargetCoordinateSystem(RGB_SOCKET)
38 align.outputAligned.link(pc.inputDepth)
39 colorOut.link(pc.inputColor)
40
41 remote = dai.RemoteConnection()
42 remote.addTopic("pcl", pc.outputPointCloud, "3d")
43
44 p.start()
45 remote.registerPipeline(p)
46 print("Visualizer running at http://localhost:8082")
47
48 while p.isRunning():
49 key = remote.waitKey(1)
50 if key == ord("q"):
51 break需要帮助?
请访问讨论论坛以获取技术支持或您可能有的任何其他问题。