Mat mat_eye = Mat::eye(Size(10,10), CV_8UC1);
FileStorage fs(".\\vocabulary.xml", FileStorage::WRITE);
fs<<"vocabulary"<<mat_eye;
fs.release();
在另一处,需要加载这个矩阵数据。代码如下:
FileStorage fs(".\\vocabulary.xml", FileStorage::READ);
Mat mat_vocabulary;
fs["vocabulary"] >> mat_vocabulary;