基于OpenCV的计算机视觉技术实现.rar

源代码在线查看: 5-5.cpp

软件大小: 13882 K
上传用户: wylyyzjz
关键词: OpenCV 计算机视觉 技术实现
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				//
				/*
				
				#include "cxcore.h"
				#include 
				
				void main()
				  {
					 int a = 1;				//待写入的整形数据
					 float b = 2.;				//待写入的浮点型数据
					 double c[] = {4.5,6.7,8.9};		//待写入的数组
				
					 CvMat* mat = cvCreateMat( 3, 3, CV_32SC1);//待写入的矩阵数据类型	
					 cvSetIdentity(mat);
				
					 //打开文件存储器,指定待写入的文件是当前目录下的test.xml文件
					 CvFileStorage* fs = cvOpenFileStorage("test.xml",0,CV_STORAGE_WRITE);
				
					 //cvWriteInt(fs,"a",a);
					 //cvWriteReal(fs,"b",b);
				
					//--------cvWriteComment写入注释语句-------------------
				
					cvWriteComment( fs, "writing_data", 1 );	// 注释最好用英文,中文虽然能写入但是读取的时候会出错
				
					 
				cvStartWriteStruct(fs,"My_Data",CV_NODE_MAP,0,cvAttrList(0,0));
				
				
					//写入数组c,它的标记是"c"
					 cvStartWriteStruct(fs,"c",CV_NODE_SEQ,0,cvAttrList(0,0));
				
					 cvWriteRawData(fs,c,3,"d");
				
					 cvEndWriteStruct(fs);
				
					//写入CvMat* mat单位矩阵
					 cvWrite( fs, "Identity_Mat", mat, cvAttrList(NULL,NULL) );
				
				
					cvStartWriteStruct(fs,"CV_NODE_MAP",CV_NODE_MAP,0,cvAttrList(0,0));
						
						//写入整型数据a 它的标记是"a"
						cvWriteInt(fs,"a",a);
				
						//写入浮点型数据b 它的标记是"b"
						cvWriteReal(fs,"b",b);	//这个是不能放到startWriteStruct 与 endWriteStruct之间的
				
						//再次写入数组c,注意cvWriteRawData的写入要在cvStartWriteStruct和cvEndWriteStruct之间
						cvStartWriteStruct(fs,"c",CV_NODE_SEQ,0,cvAttrList(0,0));
				
						cvWriteRawData(fs,c,3,"d");
				
						cvEndWriteStruct(fs);
				
				
					cvEndWriteStruct(fs);
				
				
				cvEndWriteStruct(fs);
				
					 cvReleaseFileStorage(&fs);	//释放文件存储器,不能缺少,不然数据写入完整
					  cvReleaseMat(&mat);
				
				
				}
				
				
				//*/			

相关资源