Vector of words to represent images
| 36 | |
| 37 | /// Vector of words to represent images |
| 38 | class BowVector : public std::map<WordId, WordValue> { |
| 39 | public: |
| 40 | /** |
| 41 | * Constructor |
| 42 | */ |
| 43 | BowVector(void); |
| 44 | |
| 45 | /** |
| 46 | * Destructor |
| 47 | */ |
| 48 | ~BowVector(void); |
| 49 | |
| 50 | /** |
| 51 | * Adds a value to a word value existing in the vector, or creates a new |
| 52 | * word with the given value |
| 53 | * @param id word id to look for |
| 54 | * @param v value to create the word with, or to add to existing word |
| 55 | */ |
| 56 | void addWeight(WordId id, WordValue v); |
| 57 | |
| 58 | /** |
| 59 | * Adds a word with a value to the vector only if this does not exist yet |
| 60 | * @param id word id to look for |
| 61 | * @param v value to give to the word if this does not exist |
| 62 | */ |
| 63 | void addIfNotExist(WordId id, WordValue v); |
| 64 | |
| 65 | /** |
| 66 | * L1-Normalizes the values in the vector |
| 67 | * @param norm_type norm used |
| 68 | */ |
| 69 | void normalize(LNorm norm_type); |
| 70 | |
| 71 | /** |
| 72 | * Prints the content of the bow vector |
| 73 | * @param out stream |
| 74 | * @param v |
| 75 | */ |
| 76 | friend std::ostream& operator<<(std::ostream& out, const BowVector& v); |
| 77 | |
| 78 | /** |
| 79 | * Saves the bow vector as a vector in a matlab file |
| 80 | * @param filename |
| 81 | * @param W number of words in the vocabulary |
| 82 | */ |
| 83 | void saveM(const std::string& filename, size_t W) const; |
| 84 | }; |
| 85 | |
| 86 | } // namespace DBoW2 |
| 87 |
nothing calls this directly
no outgoing calls
no test coverage detected