Commit b0627f34f87f1fd06bba516430779d5fe177f2d3
Merge pull request #408 from biometrics/embedded
Embedded
Showing
8 changed files
with
62 additions
and
41 deletions
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 ®exp) | |
| 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 ®exp); | |
| 15 | + | |
| 16 | +} // namespace br | |
| 17 | + | |
| 18 | +#endif // BR_CORE_UTILITY_H | ... | ... |
openbr/gui/utility.cpp
| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | #include <assert.h> |
| 4 | 4 | #include <opencv2/imgproc/imgproc.hpp> |
| 5 | 5 | #include <opencv2/imgproc/imgproc_c.h> |
| 6 | -#include <openbr/core/qtutils.h> | |
| 7 | 6 | #include "utility.h" |
| 8 | 7 | |
| 9 | 8 | using namespace cv; |
| ... | ... | @@ -46,35 +45,3 @@ QImage br::toQImage(const Mat &mat) |
| 46 | 45 | |
| 47 | 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 ®exp) | |
| 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 | 4 | #include <QImage> |
| 5 | 5 | #include <QStringList> |
| ... | ... | @@ -12,9 +12,7 @@ namespace br |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | 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 ®exp); | |
| 17 | 15 | |
| 18 | 16 | } // namespace br |
| 19 | 17 | |
| 20 | -#endif // BR_UTILITY_H | |
| 18 | +#endif // BR_GUI_UTILITY_H | ... | ... |
openbr/plugins/cmake/db.cmake
0 → 100644
openbr/plugins/cmake/xml.cmake
0 → 100644
openbr/plugins/gallery/db.cpp
| ... | ... | @@ -38,7 +38,6 @@ class dbGallery : public Gallery |
| 38 | 38 | QString query = file.get<QString>("query"); |
| 39 | 39 | QString subset = file.get<QString>("subset", ""); |
| 40 | 40 | |
| 41 | -#ifndef BR_EMBEDDED | |
| 42 | 41 | QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); |
| 43 | 42 | db.setDatabaseName(file); |
| 44 | 43 | if (!db.open()) qFatal("Failed to open SQLite database %s.", qPrintable(file.name)); |
| ... | ... | @@ -167,7 +166,6 @@ class dbGallery : public Gallery |
| 167 | 166 | } |
| 168 | 167 | |
| 169 | 168 | db.close(); |
| 170 | -#endif // BR_EMBEDDED | |
| 171 | 169 | |
| 172 | 170 | *done = true; |
| 173 | 171 | return templates; | ... | ... |