- FileStorage fs2("test.yml", FileStorage::READ);
- // first method: use (type) operator on FileNode.
- int frameCount = (int)fs2["frameCount"];
- std::string date;
- // second method: use FileNode::operator >>
- fs2["calibrationDate"] >> date;
- Mat cameraMatrix2, distCoeffs2;
- fs2["cameraMatrix"] >> cameraMatrix2;
- fs2["distCoeffs"] >> distCoeffs2;
- cout << "frameCount: " << frameCount << endl
- << "calibration date: " << date << endl
- << "camera matrix: " << cameraMatrix2 << endl
- << "distortion coeffs: " << distCoeffs2 << endl;
- FileNode features = fs2["features"];
- FileNodeIterator it = features.begin(), it_end = features.end();
- int idx = 0;
- std::vector<uchar> lbpval;
- // iterate through a sequence using FileNodeIterator
- for( ; it != it_end; ++it, idx++ )
- {
- cout << "feature #" << idx << ": ";
- cout << "x=" << (int)(*it)["x"] << ", y=" << (int)(*it)["y"] << ", lbp: (";
- // you can also easily read numerical arrays using FileNode >> std::vector operator.
- (*it)["lbp"] >> lbpval;
- for( int i = 0; i < (int)lbpval.size(); i++ )
- cout << " " << (int)lbpval[i];
- cout << ")" << endl;
- }
- fs.release();
读取 摄像机标定的参数
最新推荐文章于 2022-11-24 12:46:01 发布