opencv storage 操作C++

读取

#include
#include

using namespace std;
using namespace cv;

void main()
{
    //FileStorage fs("caliResult.xml",FileStorage::READ);
    FileStorage fs;
    fs.open("caliResult.xml",FileStorage::READ);
    if(!fs.isOpened())
    {
        return;
    }

    int cameraId;
    Mat intrMatrix(3,3,CV_64F);
    Mat distCoeffs(5,1,CV_64F);

    fs["cameraId"]>>cameraId;//下面还有子节点,data 行列等信息,这个读取方式就不用一步一步的读取了
    fs["intrinsic_parameters"]>>intrMatrix;
    fs["distortion_parametes"]>>distCoeffs;

    fs.release();
}

 

posted @ 2020-08-26 17:40  yunshangyue  阅读(250)  评论(0编辑  收藏  举报