opencv 保存mat矩阵的数据
·
图像处理的过程中,有时候会需要保存数据。之前,用的比较多的是imwrite函数,但其只能保存整数数据,且需作为图像格式。当需要保存浮点数据或XML/YML文件时,我们可以使用FileStorage类。
1、保存mat矩阵
FileStorage fs("xuchao.xml", FileStorage::WRITE);
fs << "vocabulary" << image;
fs.release();
2、读取文件数据到mat矩阵
FileStorage fs("xuchao.xml", FileStorage::READ);
Mat mat_vocabulary;
fs["vocabulary"] >> mat_vocabulary;
fs.release();
是不是感觉很简单。
更多推荐



所有评论(0)