<?xml version="1.0" ?> - <opencv_storage> - <Record1> + <ImageDescriptors type_id="opencv-matrix"> </Record1> - <Record2> + <ImageDescriptors type_id="opencv-matrix"> </Record2> - <Record3> + <ImageDescriptors type_id="opencv-matrix"> </Record3> - <Record4> + <ImageDescriptors type_id="opencv-matrix"> </Record4> - <Record5> + <ImageDescriptors type_id="opencv-matrix"> </Record5> - <Record6> + <ImageDescriptors type_id="opencv-matrix"> </Record6>
我现在想通过循环一条一条地将记录数据读取出来,比如先读取<record1>下的<mageDescriptors>里面的数据,进行处理,再接着读取<record2>下的<mageDescriptors>里面的数据,进行处理,。。。以此类推。现在我在一个循环里面写了下面的代码,但是调试的时候,始终无法获取,不知道怎么回事,希望您能给我指点一下,谢谢!
对结构体中的“opencv-matrix”加以区别,用下面的思路就可以了
CvFileNode *node; const char* xmlfile = "your.xml"; CvFileStorage *fs = cvOpenFileStorage( xmlfile,CV_STORAGE_READ ); node = cvGetFileNodeByName (fs,NULL,"opencv-matrix_1"); imageMat_1= (CvMat *) cvRead (fs,node); node = cvGetFileNodeByName (fs,"opencv-matrix_2"); imageMat_2 = (CvMat *) cvRead (fs,node); ... node = cvGetFileNodeByName (fs,"opencv-matrix_n"); imageMat_n = (CvMat *) cvRead (fs,node); cvReleaseFileStorage (&fs);
转载网站为http://www.opencv.org.cn/forum/viewtopic.php?f=1&t=8516 (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|