DepthAI Tutorials
DepthAI API References

ON THIS PAGE

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

Calibration Flash

This example shows how to flash calibration data of version 6 (gen2 calibration data) to the device.

Similar samples:

Demo

Example script output
Command Line
1~/depthai-python/examples$ python3 Calibration/calibration_flash.py
2    Calibration Data on the device is backed up at:
3    /home/erik/Luxonis/depthai-python/examples/Calibration/depthai_calib_backup.json
4    # Calibration Flash Successful

Setup

Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai-python repository first and then run the script
Command Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
For additional information, please follow the installation guide.

Source code

Python
C++

Python

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

Need assistance?

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