FeatureVector.cpp
Go to the documentation of this file.
1 
10 #include "FeatureVector.h"
11 #include <map>
12 #include <vector>
13 #include <iostream>
14 
15 namespace DBoW2 {
16 
17 // ---------------------------------------------------------------------------
18 
20 {
21 }
22 
23 // ---------------------------------------------------------------------------
24 
26 {
27 }
28 
29 // ---------------------------------------------------------------------------
30 
31 void FeatureVector::addFeature(NodeId id, unsigned int i_feature)
32 {
33  FeatureVector::iterator vit = this->lower_bound(id);
34 
35  if(vit != this->end() && vit->first == id)
36  {
37  vit->second.push_back(i_feature);
38  }
39  else
40  {
41  vit = this->insert(vit, FeatureVector::value_type(id,
42  std::vector<unsigned int>() ));
43  vit->second.push_back(i_feature);
44  }
45 }
46 
47 // ---------------------------------------------------------------------------
48 
49 std::ostream& operator<<(std::ostream &out,
50  const FeatureVector &v)
51 {
52  if(!v.empty())
53  {
54  FeatureVector::const_iterator vit = v.begin();
55 
56  const std::vector<unsigned int>* f = &vit->second;
57 
58  out << "<" << vit->first << ": [";
59  if(!f->empty()) out << (*f)[0];
60  for(unsigned int i = 1; i < f->size(); ++i)
61  {
62  out << ", " << (*f)[i];
63  }
64  out << "]>";
65 
66  for(++vit; vit != v.end(); ++vit)
67  {
68  f = &vit->second;
69 
70  out << ", <" << vit->first << ": [";
71  if(!f->empty()) out << (*f)[0];
72  for(unsigned int i = 1; i < f->size(); ++i)
73  {
74  out << ", " << (*f)[i];
75  }
76  out << "]>";
77  }
78  }
79 
80  return out;
81 }
82 
83 // ---------------------------------------------------------------------------
84 
85 } // namespace DBoW2
f
friend std::ostream & operator<<(std::ostream &out, const FeatureVector &v)
Vector of nodes with indexes of local features.
Definition: FeatureVector.h:21
void addFeature(NodeId id, unsigned int i_feature)
unsigned int NodeId
Id of nodes in the vocabulary treee.
Definition: BowVector.h:26


orb_slam2_ros
Author(s):
autogenerated on Wed Apr 21 2021 02:53:05