Calibration Flash v5
This example shows how to flash calibration data of version 5 (gen1 calibration data) to the device.Similar samples:
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 scriptCommand Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
Source code
Python
C++
Python
PythonGitHub
1#!/usr/bin/env python3
2
3from pathlib import Path
4import cv2
5import depthai as dai
6import argparse
7
8boardConfigFile = str((Path(__file__).parent / Path('../models/BW1098OBC.json')).resolve().absolute())
9calibBinaryFile = str((Path(__file__).parent / Path('../models/depthai_v5.calib')).resolve().absolute())
10calibBackUpFile = str((Path(__file__).parent / Path('depthai_calib_backup.json')).resolve().absolute())
11
12parser = argparse.ArgumentParser()
13parser.add_argument('boardConfigFile', nargs='?', help="Path to board config file", default=boardConfigFile)
14parser.add_argument('calibBinaryFile', nargs='?', help="Path to version 5 .calib file", default=calibBinaryFile)
15args = parser.parse_args()
16
17# Connect device
18with dai.Device() as device:
19
20 deviceCalib = device.readCalibration()
21 deviceCalib.eepromToJsonFile(calibBackUpFile)
22 print("Calibration Data on the device is backed up at:")
23 print(calibBackUpFile)
24 calibData = dai.CalibrationHandler(args.calibBinaryFile, args.boardConfigFile)
25
26 status = device.flashCalibration(calibData)
27 if status:
28 print('Calibration Flash Successful')
29 else:
30 print('Calibration Flash Failed!!!')
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.