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

本页目录

  • 管道
  • 源代码
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包
最后更新
Supported on:RVC2RVC4
该示例创建了一个管道,以 60 FPS 捕获 640x400 立体摄像头帧和以 200 Hz 捕获 IMU 数据,使用 BasaltVIO 处理它们以进行视觉里程计,并将生成的变换和图像流式传输到 RerunNode 进行实时可视化。此示例需要 DepthAI v3 API,请参阅 安装说明。

管道

源代码

Python

Python
GitHub
1import signal
2import time
3import depthai as dai
4from rerun_node import RerunNode
5# Create pipeline
6
7with dai.Pipeline() as p:
8    fps = 60
9    width = 640
10    height = 400
11    # Define sources and outputs
12    left = p.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B, sensorFps=fps)
13    right = p.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C, sensorFps=fps)
14    imu = p.create(dai.node.IMU)
15    odom = p.create(dai.node.BasaltVIO)
16
17    rerunViewer = p.create(RerunNode)
18    imu.enableIMUSensor([dai.IMUSensor.ACCELEROMETER_RAW, dai.IMUSensor.GYROSCOPE_RAW], 200)
19    imu.setBatchReportThreshold(1)
20    imu.setMaxBatchReports(10)
21
22    # Linking
23    left.requestOutput((width, height)).link(odom.left)
24    right.requestOutput((width, height)).link(odom.right)
25    imu.out.link(odom.imu)
26    odom.passthrough.link(rerunViewer.inputImg)
27    odom.transform.link(rerunViewer.inputPose)
28    p.start()
29    while p.isRunning():
30        time.sleep(0.01)

C++

1#include "depthai/depthai.hpp"
2#include "rerun_node.hpp"
3
4int main() {
5    using namespace std;
6
7    // Create pipeline
8    dai::Pipeline pipeline;
9    int fps = 60;
10    int width = 640;
11    int height = 400;
12    // Define sources and outputs
13    auto left = pipeline.create<dai::node::Camera>()->build(dai::CameraBoardSocket::CAM_B, std::nullopt, fps);
14    auto right = pipeline.create<dai::node::Camera>()->build(dai::CameraBoardSocket::CAM_C, std::nullopt, fps);
15    auto imu = pipeline.create<dai::node::IMU>();
16    auto odom = pipeline.create<dai::node::BasaltVIO>();
17
18    auto rerun = pipeline.create<RerunNode>();
19    imu->enableIMUSensor({dai::IMUSensor::ACCELEROMETER_RAW, dai::IMUSensor::GYROSCOPE_RAW}, 200);
20    imu->setBatchReportThreshold(1);
21    imu->setMaxBatchReports(10);
22
23    // Linking
24    left->requestOutput(std::make_pair(width, height))->link(odom->left);
25    right->requestOutput(std::make_pair(width, height))->link(odom->right);
26    imu->out.link(odom->imu);
27    odom->transform.link(rerun->inputOdom);
28    odom->passthrough.link(rerun->inputImg);
29
30    pipeline.start();
31    pipeline.wait();
32}

需要帮助?

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