Added option to recursively parse subdirectories when loading objects (File->"Load objects...")

This commit is contained in:
matlabbe
2015-06-03 21:46:35 -04:00
parent 34f0262bfd
commit 76b6ff4b7e
7 changed files with 111 additions and 43 deletions
+3 -3
View File
@@ -70,7 +70,7 @@ public:
// Those maps have the same size
QMultiMap<int, QTransform> objDetected_;
QMultiMap<int, QSize> objDetectedSizes_; // Object ID <width, height> match the number of detected objects
QMultiMap<int, QString > objDetectedFilenames_; // Object ID <filename> match the number of detected objects
QMultiMap<int, QString > objDetectedFilePaths_; // Object ID <filename> match the number of detected objects
QMultiMap<int, int> objDetectedInliersCount_; // ObjectID <count> match the number of detected objects
QMultiMap<int, int> objDetectedOutliersCount_; // ObjectID <count> match the number of detected objects
QMultiMap<int, QMultiMap<int, int> > objDetectedInliers_; // ObjectID Map< ObjectDescriptorIndex, SceneDescriptorIndex >, match the number of detected objects
@@ -98,7 +98,7 @@ inline QDataStream & operator<<(QDataStream &out, const DetectionInfo & info)
QMultiMap<int, int>::const_iterator iterInliers = info.objDetectedInliersCount_.constBegin();
QMultiMap<int, int>::const_iterator iterOutliers = info.objDetectedOutliersCount_.constBegin();
QMultiMap<int, QSize>::const_iterator iterSizes = info.objDetectedSizes_.constBegin();
QMultiMap<int, QString>::const_iterator iterFilenames = info.objDetectedFilenames_.constBegin();
QMultiMap<int, QString>::const_iterator iterFilenames = info.objDetectedFilePaths_.constBegin();
for(QMultiMap<int, QTransform>::const_iterator iter=info.objDetected_.constBegin();
iter!=info.objDetected_.constEnd();
++iter)
@@ -148,7 +148,7 @@ inline QDataStream & operator>>(QDataStream &in, DetectionInfo & info)
in >> id >> size >> homography >> filename >> inliers >> outliers;
info.objDetected_.insert(id, homography);
info.objDetectedSizes_.insert(id, size);
info.objDetectedFilenames_.insert(id, filename);
info.objDetectedFilePaths_.insert(id, filename);
info.objDetectedInliersCount_.insert(id, inliers);
info.objDetectedOutliersCount_.insert(id, outliers);
}
+3 -3
View File
@@ -69,9 +69,9 @@ public:
bool saveSession(const QString & path);
bool isSessionModified() const {return sessionModified_;}
int loadObjects(const QString & dirPath); // call updateObjects()
int loadObjects(const QString & dirPath, bool recursive = false); // call updateObjects()
const ObjSignature * addObject(const QString & filePath);
const ObjSignature * addObject(const cv::Mat & image, int id=0, const QString & filename = QString());
const ObjSignature * addObject(const cv::Mat & image, int id=0, const QString & filePath = QString());
bool addObject(ObjSignature * obj); // take ownership when true is returned
void removeObject(int id);
void removeAllObjects();
@@ -86,7 +86,7 @@ public:
const Vocabulary * vocabulary() const {return vocabulary_;}
public Q_SLOTS:
void addObjectAndUpdate(const cv::Mat & image, int id=0, const QString & filename = QString());
void addObjectAndUpdate(const cv::Mat & image, int id=0, const QString & filePath = QString());
void removeObjectAndUpdate(int id);
void detect(const cv::Mat & image); // emit objectsFound()
+1 -1
View File
@@ -115,7 +115,7 @@ Q_SIGNALS:
private:
bool loadSettings(const QString & path);
bool saveSettings(const QString & path) const;
int loadObjects(const QString & dirPath);
int loadObjects(const QString & dirPath, bool recursive = false);
int saveObjects(const QString & dirPath);
void setupTCPServer();
int addObjectFromFile(const QString & filePath);