Commit b0627f34f87f1fd06bba516430779d5fe177f2d3

Authored by Scott Klum
2 parents 73d45493 c2092d86

Merge pull request #408 from biometrics/embedded

Embedded
openbr/core/utility.cpp 0 → 100644
  1 +#include <openbr/core/qtutils.h>
  2 +#include "utility.h"
  3 +
  4 +QStringList br::getFiles(QDir dir, bool recursive)
  5 +{
  6 + dir = QDir(dir.canonicalPath());
  7 +
  8 + QStringList files;
  9 + foreach (const QString &file, QtUtils::naturalSort(dir.entryList(QDir::Files)))
  10 + files.append(dir.absoluteFilePath(file));
  11 +
  12 + if (!recursive) return files;
  13 +
  14 + foreach (const QString &folder, QtUtils::naturalSort(dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))) {
  15 + QDir subdir(dir);
  16 + bool success = subdir.cd(folder); if (!success) qFatal("cd failure.");
  17 + files.append(getFiles(subdir, true));
  18 + }
  19 + return files;
  20 +}
  21 +
  22 +QStringList br::getFiles(const QString &regexp)
  23 +{
  24 + QFileInfo fileInfo(regexp);
  25 + QDir dir(fileInfo.dir());
  26 + QRegExp re(fileInfo.fileName());
  27 + re.setPatternSyntax(QRegExp::Wildcard);
  28 +
  29 + QStringList files;
  30 + foreach (const QString &fileName, dir.entryList(QDir::Files))
  31 + if (re.exactMatch(fileName))
  32 + files.append(dir.filePath(fileName));
  33 + return files;
  34 +}
openbr/core/utility.h 0 → 100644
  1 +#ifndef BR_CORE_UTILITY_H
  2 +#define BR_CORE_UTILITY_H
  3 +
  4 +#include <QStringList>
  5 +#include <QDir>
  6 +
  7 +#include <opencv2/core/core.hpp>
  8 +#include <openbr/openbr_export.h>
  9 +
  10 +namespace br
  11 +{
  12 +
  13 +BR_EXPORT QStringList getFiles(QDir dir, bool recursive);
  14 +BR_EXPORT QStringList getFiles(const QString &regexp);
  15 +
  16 +} // namespace br
  17 +
  18 +#endif // BR_CORE_UTILITY_H
openbr/gui/utility.cpp
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 #include <assert.h> 3 #include <assert.h>
4 #include <opencv2/imgproc/imgproc.hpp> 4 #include <opencv2/imgproc/imgproc.hpp>
5 #include <opencv2/imgproc/imgproc_c.h> 5 #include <opencv2/imgproc/imgproc_c.h>
6 -#include <openbr/core/qtutils.h>  
7 #include "utility.h" 6 #include "utility.h"
8 7
9 using namespace cv; 8 using namespace cv;
@@ -46,35 +45,3 @@ QImage br::toQImage(const Mat &amp;mat) @@ -46,35 +45,3 @@ QImage br::toQImage(const Mat &amp;mat)
46 45
47 return QImage(mat8uc3.data, mat8uc3.cols, mat8uc3.rows, 3*mat8uc3.cols, QImage::Format_RGB888).copy(); 46 return QImage(mat8uc3.data, mat8uc3.cols, mat8uc3.rows, 3*mat8uc3.cols, QImage::Format_RGB888).copy();
48 } 47 }
49 -  
50 -QStringList br::getFiles(QDir dir, bool recursive)  
51 -{  
52 - dir = QDir(dir.canonicalPath());  
53 -  
54 - QStringList files;  
55 - foreach (const QString &file, QtUtils::naturalSort(dir.entryList(QDir::Files)))  
56 - files.append(dir.absoluteFilePath(file));  
57 -  
58 - if (!recursive) return files;  
59 -  
60 - foreach (const QString &folder, QtUtils::naturalSort(dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))) {  
61 - QDir subdir(dir);  
62 - bool success = subdir.cd(folder); if (!success) qFatal("cd failure.");  
63 - files.append(getFiles(subdir, true));  
64 - }  
65 - return files;  
66 -}  
67 -  
68 -QStringList br::getFiles(const QString &regexp)  
69 -{  
70 - QFileInfo fileInfo(regexp);  
71 - QDir dir(fileInfo.dir());  
72 - QRegExp re(fileInfo.fileName());  
73 - re.setPatternSyntax(QRegExp::Wildcard);  
74 -  
75 - QStringList files;  
76 - foreach (const QString &fileName, dir.entryList(QDir::Files))  
77 - if (re.exactMatch(fileName))  
78 - files.append(dir.filePath(fileName));  
79 - return files;  
80 -}  
openbr/gui/utility.h
1 -#ifndef BR_UTILITY_H  
2 -#define BR_UTILITY_H 1 +#ifndef BR_GUI_UTILITY_H
  2 +#define BR_GUI_UTILITY_H
3 3
4 #include <QImage> 4 #include <QImage>
5 #include <QStringList> 5 #include <QStringList>
@@ -12,9 +12,7 @@ namespace br @@ -12,9 +12,7 @@ namespace br
12 { 12 {
13 13
14 BR_EXPORT QImage toQImage(const cv::Mat &mat); 14 BR_EXPORT QImage toQImage(const cv::Mat &mat);
15 -BR_EXPORT QStringList getFiles(QDir dir, bool recursive);  
16 -BR_EXPORT QStringList getFiles(const QString &regexp);  
17 15
18 } // namespace br 16 } // namespace br
19 17
20 -#endif // BR_UTILITY_H 18 +#endif // BR_GUI_UTILITY_H
openbr/plugins/cmake/db.cmake 0 → 100644
  1 +if(${BR_EMBEDDED})
  2 + set(BR_EXCLUDED_PLUGINS ${BR_EXCLUDED_PLUGINS} plugins/gallery/db.cpp)
  3 +endif()
openbr/plugins/cmake/xml.cmake 0 → 100644
  1 +if(${BR_EMBEDDED})
  2 + set(BR_EXCLUDED_PLUGINS ${BR_EXCLUDED_PLUGINS} plugins/gallery/xml.cpp)
  3 +endif()
openbr/plugins/gallery/db.cpp
@@ -38,7 +38,6 @@ class dbGallery : public Gallery @@ -38,7 +38,6 @@ class dbGallery : public Gallery
38 QString query = file.get<QString>("query"); 38 QString query = file.get<QString>("query");
39 QString subset = file.get<QString>("subset", ""); 39 QString subset = file.get<QString>("subset", "");
40 40
41 -#ifndef BR_EMBEDDED  
42 QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); 41 QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
43 db.setDatabaseName(file); 42 db.setDatabaseName(file);
44 if (!db.open()) qFatal("Failed to open SQLite database %s.", qPrintable(file.name)); 43 if (!db.open()) qFatal("Failed to open SQLite database %s.", qPrintable(file.name));
@@ -167,7 +166,6 @@ class dbGallery : public Gallery @@ -167,7 +166,6 @@ class dbGallery : public Gallery
167 } 166 }
168 167
169 db.close(); 168 db.close();
170 -#endif // BR_EMBEDDED  
171 169
172 *done = true; 170 *done = true;
173 return templates; 171 return templates;
openbr/plugins/gallery/empty.cpp
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 18
19 #include <openbr/plugins/openbr_internal.h> 19 #include <openbr/plugins/openbr_internal.h>
20 #include <openbr/core/qtutils.h> 20 #include <openbr/core/qtutils.h>
21 -#include <openbr/gui/utility.h> 21 +#include <openbr/core/utility.h>
22 22
23 namespace br 23 namespace br
24 { 24 {