DepthAI
  • DepthAI组件
    • AprilTags
    • 基准测试
    • 相机
    • 校准
    • DetectionNetwork
    • 事件
    • FeatureTracker
    • HostNodes
    • ImageAlign
    • ImageManip
    • IMU
    • 杂项
    • 模型库
    • NeuralDepth
    • NeuralNetwork
    • ObjectTracker
    • 点云
    • RecordReplay
    • RGBD
    • 脚本
    • SpatialDetectionNetwork
    • SpatialLocationCalculator
    • StereoDepth
    • 同步
    • VideoEncoder
    • 可视化器
    • VSLAM
    • 扭曲
    • RVC2 特有
  • 高级教程
  • API 参考
  • 工具
软件栈

本页目录

  • 类似示例
  • 演示
  • 设置
  • 源码

校准加载

Supported on:RVC2RVC4
本示例展示了如何在管线中从 JSON 文件加载并使用校准数据,以生成深度帧。

类似示例

演示

示例脚本输出显示了深度可视化窗口。脚本从 JSON 文件加载校准数据,并用其配置立体深度管线。
Command Line
1~/depthai-core/examples/python/calibration$ python3 calibration_load.py path/to/calibration.json
2# 深度窗口打开,显示立体深度输出
3# 按 'q' 键退出

设置

这个示例需要DepthAI v3 API,参见安装说明

源码

Python
GitHub
1#!/usr/bin/env python3
2import cv2
3import depthai as dai
4import argparse
5import cv2
6
7parser = argparse.ArgumentParser()
8parser.add_argument("calibJsonFile", help="Path to calibration file in json")
9args = parser.parse_args()
10
11calibData = dai.CalibrationHandler(args.calibJsonFile)
12
13with dai.Pipeline() as pipeline:
14    pipeline.setCalibrationData(calibData)
15    # Define sources and output
16    monoLeft = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
17    monoRight = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
18    resolution = (640, 480)
19    stereo = pipeline.create(dai.node.StereoDepth).build(
20        monoLeft.requestOutput(resolution), monoRight.requestOutput(resolution)
21    )
22    depthQueue = stereo.depth.createOutputQueue()
23    pipeline.start()
24    while True:
25        # blocking call, will wait until a new data has arrived
26        inDepth = depthQueue.get()
27        frame = inDepth.getFrame()
28        # frame is ready to be shown
29        cv2.imshow("depth", frame)
30        if cv2.waitKey(1) == ord("q"):
31            break

需要帮助?

请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。