Advertisement

OpenCV学习笔记(四):XML,YAML文件及其(.txt,.doc)文本类型读写操作

阅读量:

OpenCV学习笔记(四):XML,YAML(.txt,.doc)文件读写操作

一、生成XML及YAML文件(编写XML文件)

复制代码
    #include <opencv2/opencv.hpp>
    #include <time.h>
    
    using namespace cv;
    
    int main()
    {
    // 1、准备文件写操作
    FileStorage fs("F:/C++/2. OPENCV 3.1.0/TEST/test.txt", FileStorage::WRITE);
    
    // 2、开始文件写入
    fs << "frameCount" << 5;
    
    // 3、写入时间
    time_t rawtime;  // 64-bit time value
    time(&rawtime);
    fs << "calibrationDate" << asctime(localtime(&rawtime));
    
    // 4、写入矩阵
    Mat cameraMatrix = (Mat_<double>(3, 3) << 1000, 0, 320, 0, 1000, 240, 0, 0, 1);
    Mat distCoeffs = 

全部评论 (0)

还没有任何评论哟~