refactored opencv_stitching

This commit is contained in:
Alexey Spizhevoy
2011-08-16 12:36:11 +00:00
parent f1e8b43c7a
commit 78bb392088
6 changed files with 39 additions and 77 deletions

View File

@@ -5,27 +5,14 @@ using namespace std;
using namespace cv;
CameraInfo CameraInfo::load(const string &path)
CameraParams::CameraParams() : focal(1), R(Mat::eye(3, 3, CV_64F)), t(Mat::zeros(3, 1, CV_64F)) {}
CameraParams::CameraParams(const CameraParams &other) { *this = other; }
const CameraParams& CameraParams::operator =(const CameraParams &other)
{
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;
focal = other.focal;
R = other.R.clone();
t = other.t.clone();
return *this;
}