-
Notifications
You must be signed in to change notification settings - Fork 126
/
calibration_flash.cpp
31 lines (25 loc) · 1020 Bytes
/
calibration_flash.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <iostream>
#include <string>
// Includes common necessary includes for development using depthai library
#include "depthai/depthai.hpp"
int main(int argc, char** argv) {
std::string calibJsonFile(CALIB_PATH);
std::string calibBackUpFile("depthai_calib_backup.json");
if(argc > 1) {
calibJsonFile = std::string(argv[1]);
}
// Connect device
dai::Device device(dai::OpenVINO::VERSION_UNIVERSAL, dai::UsbSpeed::HIGH);
dai::CalibrationHandler deviceCalib = device.readCalibration();
deviceCalib.eepromToJsonFile(calibBackUpFile);
std::cout << "Calibration Data on the device is backed up at:" << calibBackUpFile << std::endl;
dai::CalibrationHandler calibData(calibJsonFile);
try {
device.flashCalibration2(calibData);
std::cout << "Successfully flashed calibration" << std::endl;
} catch(const std::exception& ex) {
std::cout << "Failed flashing calibration: " << ex.what() << std::endl;
}
return 0;
}