代码拉取完成,页面将自动刷新
// Example 8-3. Using cv::FileStorage to read a .yml file
//
#include <opencv2/opencv.hpp>
using namespace std;
int main(int argc, char** argv) {
cout << "\nExample 8-3. Using cv::FileStorage to read a .yml file"
<< "\nCall:\n"
<< argv[0] << endl;
cv::FileStorage fs2("test.yml", cv::FileStorage::READ);
// first method: use (type) operator on FileNode.
//
int frameCount = (int)fs2["frameCount"];
// second method: use cv::FileNode::operator >>
//
std::string date;
fs2["calibrationDate"] >> date;
cv::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;
cv::FileNode features = fs2["features"];
cv::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: (";
// ( Note: easily read numerical arrays using FileNode >> std::vector. )
//
(*it)["lbp"] >> lbpval;
for( int i = 0; i < (int)lbpval.size(); i++ )
cout << " " << (int)lbpval[i];
cout << ")" << endl;
}
fs2.release();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。