读取 摄像机标定的参数

  1. FileStorage fs2("test.yml", FileStorage::READ);  
  2.   
  3. // first method: use (type) operator on FileNode.  
  4. int frameCount = (int)fs2["frameCount"];  
  5.   
  6. std::string date;  
  7. // second method: use FileNode::operator >>  
  8. fs2["calibrationDate"] >> date;  
  9.   
  10. Mat cameraMatrix2, distCoeffs2;  
  11. fs2["cameraMatrix"] >> cameraMatrix2;  
  12. fs2["distCoeffs"] >> distCoeffs2;  
  13.   
  14. cout << "frameCount: " << frameCount << endl  
  15.      << "calibration date: " << date << endl  
  16.      << "camera matrix: " << cameraMatrix2 << endl  
  17.      << "distortion coeffs: " << distCoeffs2 << endl;  
  18.   
  19. FileNode features = fs2["features"];  
  20. FileNodeIterator it = features.begin(), it_end = features.end();  
  21. int idx = 0;  
  22. std::vector<uchar> lbpval;  
  23.   
  24. // iterate through a sequence using FileNodeIterator  
  25. for( ; it != it_end; ++it, idx++ )  
  26. {  
  27.     cout << "feature #" << idx << ": ";  
  28.     cout << "x=" << (int)(*it)["x"] << ", y=" << (int)(*it)["y"] << ", lbp: (";  
  29.     // you can also easily read numerical arrays using FileNode >> std::vector operator.  
  30.     (*it)["lbp"] >> lbpval;  
  31.     forint i = 0; i < (int)lbpval.size(); i++ )  
  32.         cout << " " << (int)lbpval[i];  
  33.     cout << ")" << endl;  
  34. }  
  35. fs.release();  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值