Software Stack
DepthAI

ON THIS PAGE

  • Calibration Flash
  • Similar samples
  • Demo
  • Setup
  • Source code

Calibration Flash

This example shows how to flash calibration data from a JSON file to the device's EEPROM. The script automatically backs up the existing calibration data before flashing.

Similar samples

Demo

Example script output showing successful calibration flashing with automatic backup:
Command Line
1~/depthai-core/examples/python/calibration$ python3 calibration_flash.py path/to/calibration.json
2Calibration Data on the device is backed up at:
3/home/user/depthai-core/examples/python/calibration/depthai_calib_backup.json
4Successfully flashed calibration

Setup

This example requires the DepthAI v3 API, see installation instructions.

Source code

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}")

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.