2014-07-31 19:02:31 +00:00
|
|
|
/*
|
|
|
|
|
* FindObject.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: 2014-07-30
|
|
|
|
|
* Author: mathieu
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef FINDOBJECT_H_
|
|
|
|
|
#define FINDOBJECT_H_
|
|
|
|
|
|
2014-07-31 20:11:46 +00:00
|
|
|
#include "find_object/FindObjectExp.h" // DLL export/import defines
|
|
|
|
|
|
2014-08-04 01:33:52 +00:00
|
|
|
#include "find_object/DetectionInfo.h"
|
|
|
|
|
|
2014-07-31 19:02:31 +00:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QString>
|
|
|
|
|
#include <QtCore/QMap>
|
|
|
|
|
#include <QtCore/QMultiMap>
|
|
|
|
|
#include <QtCore/QPair>
|
|
|
|
|
#include <QtCore/QVector>
|
|
|
|
|
#include <QtGui/QTransform>
|
|
|
|
|
#include <QtCore/QRect>
|
|
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
class ObjSignature;
|
|
|
|
|
class Vocabulary;
|
|
|
|
|
class KeypointDetector;
|
|
|
|
|
class DescriptorExtractor;
|
|
|
|
|
|
2014-07-31 20:11:46 +00:00
|
|
|
class FINDOBJECT_EXP FindObject : public QObject
|
2014-07-31 19:02:31 +00:00
|
|
|
{
|
|
|
|
|
Q_OBJECT;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
FindObject(QObject * parent = 0);
|
|
|
|
|
virtual ~FindObject();
|
|
|
|
|
|
|
|
|
|
int loadObjects(const QString & dirPath); // call updateObjects()
|
|
|
|
|
const ObjSignature * addObject(const QString & filePath);
|
2014-08-04 01:33:52 +00:00
|
|
|
const ObjSignature * addObject(const cv::Mat & image, int id=0, const QString & filename = QString());
|
2014-07-31 19:02:31 +00:00
|
|
|
bool addObject(ObjSignature * obj); // take ownership when true is returned
|
|
|
|
|
void removeObject(int id);
|
|
|
|
|
void removeAllObjects();
|
|
|
|
|
|
2014-08-04 01:33:52 +00:00
|
|
|
bool detect(const cv::Mat & image, DetectionInfo & info);
|
2014-07-31 19:02:31 +00:00
|
|
|
|
|
|
|
|
void updateDetectorExtractor();
|
|
|
|
|
void updateObjects();
|
|
|
|
|
void updateVocabulary();
|
|
|
|
|
|
|
|
|
|
const QMap<int, ObjSignature*> & objects() const {return objects_;}
|
|
|
|
|
const Vocabulary * vocabulary() const {return vocabulary_;}
|
|
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
2014-08-04 01:33:52 +00:00
|
|
|
void detect(const cv::Mat & image); // emit objectsFound()
|
2014-07-31 19:02:31 +00:00
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
2014-08-04 01:33:52 +00:00
|
|
|
void objectsFound(const DetectionInfo &);
|
2014-07-31 19:02:31 +00:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void clearVocabulary();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QMap<int, ObjSignature*> objects_;
|
|
|
|
|
Vocabulary * vocabulary_;
|
|
|
|
|
QMap<int, cv::Mat> objectsDescriptors_;
|
|
|
|
|
QMap<int, int> dataRange_; // <last id of object's descriptor, id>
|
|
|
|
|
KeypointDetector * detector_;
|
|
|
|
|
DescriptorExtractor * extractor_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* FINDOBJECT_H_ */
|