乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      OpenCV 2.4.3 Cheat Sheet學(xué)習(xí) 數(shù)據(jù)的輸入和輸出

       昵稱14216904 2016-02-24
      // wenjianduxie.cpp : 定義控制臺應(yīng)用程序的入口點。
      //

      #include "stdafx.h"
      #include "stdafx.h"
      #include <opencv2/core/core.hpp>  
      #include <opencv2/highgui/highgui.hpp>  
      #include <iostream>  


      using namespace cv;  
      using namespace std;  

      int main( int argc, char** argv )

      {      //1.    將數(shù)據(jù)寫入YAML(或XML)
      //注意,在OpenCV中,無論讀寫,文件的格式均由指定的后綴名確定。示例:
      /*
      FileStorage fs("test.yml", FileStorage::WRITE);
      fs << "i" << 5 << "r" << 3.1 << "str" << "ABCDEFGH";
      fs << "mtx" << Mat::eye(3,3,CV_32F);
      fs << "mylist" << "[" << CV_PI << "1+1" << "{:" << "month" << 12 << "day" << 31 << "year" << 1969 << "}" << "]";
      fs << "mystruct" << "{" << "x" << 1 << "y" << 2 << "width" << 100 << "height" << 200 << "lbp" << "[:";
      const uchar arr[] = {0, 1, 1, 0, 1, 1, 0, 1};
      fs.writeRaw("u", arr, (int)(sizeof(arr)/sizeof(arr[0])));
      fs << "]" << "}";
      */

      ///*
      //1.    將數(shù)據(jù)讀回 這段代碼把上面寫入文件的數(shù)據(jù)再讀回來。
      FileStorage fs("test.yml", FileStorage::READ);
      int i1 = (int)fs["i"];
      double r1 = (double)fs["r"];
      string str1 = (string)fs["str"];
      Mat M;
      fs["mtx"] >> M;
      cout<<M<<endl;
      FileNode tl = fs["mylist"];
      CV_Assert(tl.type() == FileNode::SEQ && tl.size() == 3);
      double tl0 = (double)tl[0];
      string tl1 = (string)tl[1];
      int m = (int)tl[2]["month"], d = (int)tl[2]["day"];
      int year = (int)tl[2]["year"];
      FileNode tm = fs["mystruct"];
      Rect r;
      r.x = (int)tm["x"], r.y = (int)tm["y"];
      r.width = (int)tm["width"], r.height = (int)tm["height"];
      int lbp_val = 0;
      FileNodeIterator it = tm["lbp"].begin();
      for(int k = 0; k < 8; k++, ++it)
        lbp_val |= ((int)*it) << k;
        //*/

      cvWaitKey(0);  

      return 0;  
      }

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多