此页面由 AI 自动翻译。查看英文原版
DepthAI
  • DepthAI 组件
    • AprilTags
    • 基准测试
    • 相机
    • 校准
    • 深度
    • 检测网络
    • 事件
    • 特征跟踪器
    • 网关
    • 主机节点
    • 图像对齐
    • 图像处理
    • IMU
    • 杂项
    • 模型库
    • 神经深度
    • 神经网络
    • 对象跟踪器
    • 点云
    • 记录回放
    • RGBD
    • 脚本
    • 空间检测网络
    • 空间位置计算器
    • 立体深度
    • 同步
    • ToF
    • 视频编码器
    • 可视化工具
    • VSLAM
    • 扭曲
    • RVC2-特定
  • 高级教程
  • API 参考
  • 工具
软件栈
最后更新

本页目录

  • 源代码
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包
最后更新
Supported on:RVC2RVC4
此示例从与 RGB 摄像头对齐的 ToF 深度构建彩色 点云,并将其流式传输到 http://localhost:8082 上的 DepthAI 可视化工具。
有关运行时滤波器调整和附加点云工作流程,请参阅 ToF 点云 + 运行时调整 (oak-examples)。
此示例需要 DepthAI v3 API,请参阅 安装说明。

源代码

Python

Python
GitHub
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

需要帮助?

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