SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
WAIOrbVocabulary.h
Go to the documentation of this file.
1 /**
2  * \file WAIOrbVocabulary.h
3  * \authors Michael Goettlicher
4  * \date April 2018
5 // Codestyle: https://github.com/cpvrlab/SLProject/wiki/Coding-Style-Guidelines
6  * \authors Marcus Hudritsch
7  * \copyright http://opensource.org/licenses/GPL-3.0
8 */
9 
10 #ifndef WAI_ORBVOCABULARY_H
11 #define WAI_ORBVOCABULARY_H
12 #define USE_FBOW 1
13 
14 #include <string>
15 #include <WAIHelper.h>
16 
17 #if USE_FBOW
18 # include <fbow.h>
19 # include <vocabulary_creator.h>
20 #else
21 # include <orb_slam/ORBVocabulary.h>
22 #endif
23 
25 {
26  bool isFill = false;
28  WAIBowVector(std::vector<int> wid, std::vector<float> values);
29 #if USE_FBOW
30  fbow::fBow data;
31  fbow::fBow& getWordScoreMapping() { return data; }
32 #else
33  DBoW2::BowVector data;
34  DBoW2::BowVector& getWordScoreMapping() { return data; }
35 #endif
36 };
37 
39 {
41  bool isFill = false;
42 #if USE_FBOW
43  fbow::fBow2 data;
44  fbow::fBow2& getFeatMapping() { return data; }
45 #else
46  DBoW2::FeatureVector data;
47  DBoW2::FeatureVector& getFeatMapping() { return data; }
48 #endif
49 };
50 
52 {
53 public:
54  WAIOrbVocabulary(int layer = 2);
56  void loadFromFile(std::string strVocFile);
57  void create(std::vector<cv::Mat>& features, int k, int l);
58 
59 #if USE_FBOW
60  fbow::Vocabulary* _vocabulary = nullptr;
61 #else
62  ORB_SLAM2::ORBVocabulary* _vocabulary = nullptr;
63 #endif
64  void transform(const cv::Mat& descriptors, WAIBowVector& bow, WAIFeatVector& feat);
65  double score(WAIBowVector& bow1, WAIBowVector& bow2);
66  size_t size();
67  void save(std::string path);
68  void setLayer(int layer) { _layer = layer; }
69 
70 private:
71  int _layer;
72 };
73 
74 #endif // !WAI_ORBVOCABULARY_H
#define WAI_API
Definition: WAIHelper.h:36
void setLayer(int layer)
fbow::fBow & getWordScoreMapping()
fbow::fBow data
fbow::fBow2 data
fbow::fBow2 & getFeatMapping()