25 cv::FileStorage fs(fname, cv::FileStorage::READ);
26 if (fs.isOpened() ==
false)
throw std::runtime_error(
"Failed to load [" + fname +
']');
28 fs[
"sensor"] >> str;
sensor = jevois::from_string<jevois::CameraSensor>(str);
29 fs[
"lens"] >> str;
lens = jevois::from_string<jevois::CameraLens>(str);
31 fs[
"image_width"] >>
w;
32 fs[
"image_height"] >>
h;
41 cv::FileStorage fs(fname, cv::FileStorage::WRITE);
42 if (fs.isOpened() ==
false)
throw std::runtime_error(
"Failed to save [" + fname +
']');
46 struct tm *t2 = localtime(&tm);
48 strftime(buf,
sizeof(buf),
"%c", t2);
50 fs <<
"calibration_time" << buf;
53 fs <<
"fisheye" << fisheye;
54 fs <<
"image_width" << w;
55 fs <<
"image_height" <<
h;
56 fs <<
"camera_matrix" << camMatrix;
57 fs <<
"distortion_coefficients" << distCoeffs;
58 fs <<
"avg_reprojection_error" << avgReprojErr;
void save(std::string const &fname) const
Save to file.
jevois::CameraLens lens
Camera lens.
bool fisheye
True for fisheye lens, requires different correction.
cv::Mat camMatrix
3x3 camera matrix
cv::Mat distCoeffs
5x1 distortion coefficients
double avgReprojErr
Average reprojection error.
int h
Image width and height (camera resolution)
jevois::CameraSensor sensor
Camera sensor.
void load(std::string const &fname)
Load from file.
std::string to_string(T const &val)
Convert from type to string.