[OpenCV]保存矩阵为xml或yml文件

#include "cxcore.h"
int main( int argc, char** argv )
{
    CvMat* mat = cvCreateMat( 3, 3, CV_32F );
    CvFileStorage* fs = cvOpenFileStorage( "example.xml", 0, CV_STORAGE_WRITE );

    cvSetIdentity( mat );	// set mat as identity matrix
    cvWrite( fs, "A", mat, cvAttrList(0,0) );

    cvReleaseFileStorage( &fs );
    cvReleaseMat( &mat );
    return 0;
}

你可能感兴趣的:([OpenCV]保存矩阵为xml或yml文件)