Open Source Computer Vision Library https://opencv.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
568 B

#include <fstream>
#include "camera.hpp"
using namespace std;
using namespace cv;
CameraInfo CameraInfo::load(const string &path)
{
FileStorage fs(path, FileStorage::READ);
CV_Assert(fs.isOpened());
CameraInfo cam;
if (!fs["R"].isNone())
fs["R"] >> cam.R;
if (!fs["K"].isNone())
fs["K"] >> cam.K;
return cam;
}
void CameraInfo::save(const string &path)
{
FileStorage fs(path, FileStorage::WRITE);
CV_Assert(fs.isOpened());
if (!R.empty())
fs << "R" << R;
if (!K.empty())
fs << "K" << K;
}