1. 写yml矩阵
-
代码:
全选
-
#include "cxcore.h"
int main( int argc, char** argv )
{
CvMat* mat = cvCreateMat( 3, 3, CV_32F );
CvFileStorage* fs = cvOpenFileStorage( "example.yml", 0, CV_STORAGE_WRITE );
cvSetIdentity( mat );
cvWrite( fs, "A", mat, cvAttrList(0,0) );
cvReleaseFileStorage( &fs );
cvReleaseMat( &mat );
return 0;
}
Re: opencv 数据读写操作
2. 读yml矩阵
-
代码:
全选
-
#include <stdio.h>
#include "cxcore.h"
#include "highgui.h"
void main( )
{
CvMat* A1 = (CvMat*)cvLoad( "example.yml" );
for(int i = 0; i <3; i++ )
{
printf