此页面由 AI 自动翻译。查看英文原版
DepthAI
软件栈
最后更新

本页目录

  • 类似示例
  • 演示
  • 设置
  • 源代码
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包

校准加载

最后更新
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    resolution = (640, 480)
17    depth = pipeline.create(dai.node.Depth).build(
18        dai.node.Depth.Algorithm.STEREO, size=resolution
19    )
20    depthQueue = depth.depth.createOutputQueue()
21    pipeline.start()
22    while True:
23        # blocking call, will wait until a new data has arrived
24        inDepth = depthQueue.get()
25        frame = inDepth.getFrame()
26        # frame is ready to be shown
27        cv2.imshow("depth", frame)
28        if cv2.waitKey(1) == ord("q"):
29            break

需要帮助?

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