Skip to content

Commit

Permalink
Load vocabulary from text file (Data/ORBvoc.txt)
Browse files Browse the repository at this point in the history
Less memory usage
Faster loading

If you have created your own vocabulary using DBoW2 (https://github.com/dorian3d/DBoW2). Use the function saveToTextFile in Thirdparty/DBoW2/DBoW2/TemplatedVocabulary.h to save it as a text file.
  • Loading branch information
raulmur committed Sep 1, 2015
1 parent 4627ee0 commit 40e3502
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ int main(int argc, char **argv)
ORB_SLAM::FramePublisher FramePub;

//Load ORB Vocabulary
/* Old version to load vocabulary using cv::FileStorage
string strVocFile = ros::package::getPath("ORB_SLAM")+"/"+argv[1];
cout << endl << "Loading ORB Vocabulary. This could take a while." << endl;
cv::FileStorage fsVoc(strVocFile.c_str(), cv::FileStorage::READ);
Expand All @@ -85,6 +86,24 @@ int main(int argc, char **argv)
}
ORB_SLAM::ORBVocabulary Vocabulary;
Vocabulary.load(fsVoc);
*/

// New version to load vocabulary from text file "Data/ORBvoc.txt".
// If you have an own .yml vocabulary, use the function
// saveToTextFile in Thirdparty/DBoW2/DBoW2/TemplatedVocabulary.h
string strVocFile = ros::package::getPath("ORB_SLAM")+"/"+argv[1];
cout << endl << "Loading ORB Vocabulary. This could take a while." << endl;

ORB_SLAM::ORBVocabulary Vocabulary;
bool bVocLoad = Vocabulary.loadFromTextFile(strVocFile);

if(!bVocLoad)
{
cerr << "Wrong path to vocabulary. Path must be absolut or relative to ORB_SLAM package directory." << endl;
cerr << "Falied to open at: " << strVocFile << endl;
ros::shutdown();
return 1;
}

cout << "Vocabulary loaded!" << endl << endl;

Expand Down

0 comments on commit 40e3502

Please sign in to comment.