前言
保存成二进制格式存储的优点1).加载与保存速度快2).保存成的文件小3).保存的内容不易损坏1. 下载二进制词袋 ORBvoc.bin 放在 orbsalm2 / Vocabulary 下
下载地址https://github.com/nxyzgf/sgg-dbow2
2 DBOW2 文件夹里面 TemplatedVocabulary.h 文件修改两处内容
首先,在loadFromTextFile
函数的声明下增加loadFromBinaryFile声明:
/**
* Loads the vocabulary from a text file
* @param filename
*/
在bool loadFromTextFile(const std::string &filename);下面添加:
bool loadFromBinaryFile(const std::string &filename);
其次,第1427
行左右,添加loadFromBinaryFile
函数的定义,也就是在loadFromTextFile
函数定义下面添加:
template<class TDescriptor, class F>
bool TemplatedVocabulary<TDescriptor, F>::loadFromBinar