opencv读写xml或yxml文件

    //#include "opencv2/opencv.hpp"
    //写文件
    FileStorage fs("test.yml",FileStorage::WRITE);
    int fps = 5;
    fs << "fps" << fps;
    Mat m1 = Mat::eye(2,3,CV_32F);
    Mat result = (m1+1).mul(m1+3);
    fs << "Result" << result;
    fs.release();
    //读文件
    FileStorage fs2("test.yml",FileStorage::READ);
    Mat r;
    fs2["Result"] >> r;
    std::cout << r << std::endl;
    fs2.release();

这里写图片描述

猜你喜欢

转载自blog.csdn.net/yuxing55555/article/details/80590014
今日推荐