2014-05-11 23:57:08 +00:00
|
|
|
/*
|
|
|
|
|
* Vocabulary.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: 2014-05-09
|
|
|
|
|
* Author: mathieu
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef VOCABULARY_H_
|
|
|
|
|
#define VOCABULARY_H_
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QMultiMap>
|
2014-05-12 22:58:57 +00:00
|
|
|
#include <QtCore/QVector>
|
2014-05-11 23:57:08 +00:00
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
|
|
|
|
|
|
class Vocabulary {
|
|
|
|
|
public:
|
|
|
|
|
Vocabulary();
|
|
|
|
|
virtual ~Vocabulary();
|
|
|
|
|
|
|
|
|
|
void clear();
|
2014-07-31 19:02:31 +00:00
|
|
|
QMultiMap<int, int> addWords(const cv::Mat & descriptors, int objectId, bool incremental);
|
2014-05-11 23:57:08 +00:00
|
|
|
void update();
|
|
|
|
|
void search(const cv::Mat & descriptors, cv::Mat & results, cv::Mat & dists, int k);
|
2014-05-12 22:58:57 +00:00
|
|
|
int size() const {return indexedDescriptors_.rows + notIndexedDescriptors_.rows;}
|
2014-05-11 23:57:08 +00:00
|
|
|
const QMultiMap<int, int> & wordToObjects() const {return wordToObjects_;}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
cv::flann::Index flannIndex_;
|
2014-05-12 22:58:57 +00:00
|
|
|
cv::Mat indexedDescriptors_;
|
|
|
|
|
cv::Mat notIndexedDescriptors_;
|
2014-07-31 19:02:31 +00:00
|
|
|
QMultiMap<int, int> wordToObjects_; // <wordId, ObjectId>
|
2014-05-12 22:58:57 +00:00
|
|
|
QVector<int> notIndexedWordIds_;
|
2014-05-11 23:57:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* VOCABULARY_H_ */
|