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

本页目录

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

校准闪存

Supported on:RVC2RVC4
此示例演示了如何将 JSON 文件中的校准数据闪存到设备的 EEPROM。脚本会在闪存之前自动备份现有的校准数据。

类似示例

演示

示例脚本输出显示成功校准闪存并自动备份:
Command Line
1~/depthai-core/examples/python/calibration$ python3 calibration_flash.py path/to/calibration.json
2设备上的校准数据已备份至:
3/home/user/depthai-core/examples/python/calibration/depthai_calib_backup.json
4成功闪存校准

设置

此示例需要 DepthAI v3 API,请参阅 安装说明

源代码

Python
GitHub
1#!/usr/bin/env python3
2
3from pathlib import Path
4import depthai as dai
5import argparse
6
7calibBackUpFile = str(
8    (Path(__file__).parent / Path("depthai_calib_backup.json")).resolve().absolute()
9)
10
11parser = argparse.ArgumentParser()
12parser.add_argument("calibJsonFile", help="Path to calibration file in json")
13args = parser.parse_args()
14
15device = dai.Device(dai.UsbSpeed.HIGH)
16deviceCalib = device.readCalibration()
17deviceCalib.eepromToJsonFile(calibBackUpFile)
18print("Calibration Data on the device is backed up at:")
19print(calibBackUpFile)
20calibData = dai.CalibrationHandler(args.calibJsonFile)
21
22try:
23    device.flashCalibration(calibData)
24    print("Successfully flashed calibration")
25except Exception as ex:
26    print(f"Failed flashing calibration: {ex}")

需要帮助?

请前往 Discussion Forum 获取技术支持或提出您可能有的任何其他问题。