常见矩阵保存形式是imwrite保存至图片形式,但是当我们要保存映射表时,就需要保存矩阵,后再读取。Opencv中有快速的保存方法,比ofstream更加便捷。
输出
FileStorage fs("Pos.xml", FileStorage::WRITE);
fs << "vocabulary" << image;
fs.release();
写入
FileStorage ffs("Pos.xml", FileStorage::READ);
Mat vocabulary123;
ffs["vocabulary"] >> vocabulary123;
ffs.release();