I want to create my own vocabulary txt file. Is there any demo code similar to that provided in the original DBoW2 Repo? The original DBoW2 Repo only has the option to save as yml file.
As pointed out in #9 to use the saveToTextFile Function, it is not available in DBoW2 Repo and there is no available demo file in the ORB_SLAM2 Repo
#9 #724
@raulmur could you please provide a demo file to generate a vocabulary.txt from images
@manthan99 You can just create your vocabulary as usual with the original DBoW2 repo, save it as yaml, for example. And then use the function save as text file from Thirdparty/DBoW2 of this project to convert it from yaml to txt. Totally accepted option.
@stolpa4 Thankyou for your reply. I will try it out
@stolpa4 I am unable to compile my code which uses the function save as text file. I have created the vocabulary using the demo.cpp file and saved it as "castle_ruins.yml.gz"
Here are the lines which I am using to convert. Are these correct?
TemplatedVocabulary<DBoW2::FORB::TDescriptor, DBoW2::FORB> voc("castle_ruins.yml.gz"); //to load the vocabulary
voc.saveToTextFile("castle_ruins.txt"); //save as text file
I have included the following in the code-
#include "TemplatedVocabulary.h"
#include "BowVector.h"
#include "FeatureVector.h"
#include "FORB.h"
Yet I am getting the following error-
error: ‘FORB’ is not a member of ‘DBoW2’
TemplatedVocabulary<DBoW2::FORB::TDescriptor, DBoW2::FORB> voc("castle_ruins.yml.gz");
error: ‘FORB’ is not a member of ‘DBoW2’
Could you provide me with the working code if you have one.
@manthan99
Use Thirdparty/DBoW2 from this repo for the conversion.
1) Build the Thirdparty/DBoW2 library itself
2) Link it against it like this:
target_link_libraries(${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so
)
3) Include this file only.
4) Use ORBVocabulary instead of TemplatedVocabulary<DBoW2::FORB::TDescriptor, DBoW2::FORB>
Try this
Hii @stolpa4
Thank you very much for your help. I am able to save the vocabulary as a txt file using this -
@manthan99
Use Thirdparty/DBoW2 from this repo for the conversion.
- Build the Thirdparty/DBoW2 library itself
- Link it against it like this:
target_link_libraries(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so )
- Include this file only.
- Use
ORBVocabularyinstead ofTemplatedVocabulary<DBoW2::FORB::TDescriptor, DBoW2::FORB>Try this
Only left to check how well is this new dictionary working in my environment.
Just to clarify, we need to keep the branching factor(K) = 10 and depth(L) = 6, right?
@manthan99
If you don't want to change the source somehow, then yes (actually, not sure about the branching factor, maybe some freedom is allowed in this regard).
Glad it worked for you
Have a look at this repo for step by step procedure to create your own vocabulary:
https://github.com/manthan99/ORB_SLAM_vocab-build