Commit 5a7f96707d474aaddb0115357a601293299b4c2a
Merge branch 'master' of https://github.com/biometrics/openbr
Showing
4 changed files
with
15 additions
and
2 deletions
openbr/core/core.cpp
| @@ -520,7 +520,7 @@ private: | @@ -520,7 +520,7 @@ private: | ||
| 520 | 520 | ||
| 521 | QFileInfo dFile(file); | 521 | QFileInfo dFile(file); |
| 522 | if (dFile.exists() && !dFile.isDir()) { | 522 | if (dFile.exists() && !dFile.isDir()) { |
| 523 | - qDebug("Loading %s", qPrintable(dFile.fileName())); | 523 | + qDebug("Loading %s", qPrintable(dFile.canonicalFilePath())); |
| 524 | load(file); | 524 | load(file); |
| 525 | return true; | 525 | return true; |
| 526 | } | 526 | } |
openbr/core/eigenutils.cpp
| @@ -137,3 +137,11 @@ Eigen::MatrixXf matrixToVector(const Eigen::MatrixXf matrix) { | @@ -137,3 +137,11 @@ Eigen::MatrixXf matrixToVector(const Eigen::MatrixXf matrix) { | ||
| 137 | return vector; | 137 | return vector; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | +Eigen::MatrixXf toEigen(const Mat m) { | ||
| 141 | + if (m.type() != CV_32F) | ||
| 142 | + qFatal("Mat to Eigen Converstation only supports CV_32F"); | ||
| 143 | + | ||
| 144 | + Eigen::MatrixXf data(m.rows, m.cols); | ||
| 145 | + return Eigen::Map<const Eigen::MatrixXf>(m.ptr<float>(), m.rows, m.cols); | ||
| 146 | +} | ||
| 147 | + |
openbr/core/eigenutils.h
| @@ -21,6 +21,8 @@ | @@ -21,6 +21,8 @@ | ||
| 21 | #include <Eigen/Core> | 21 | #include <Eigen/Core> |
| 22 | #include <assert.h> | 22 | #include <assert.h> |
| 23 | 23 | ||
| 24 | +#include <opencv2/core/core.hpp> | ||
| 25 | + | ||
| 24 | void writeEigen(Eigen::MatrixXf X, QString filename); | 26 | void writeEigen(Eigen::MatrixXf X, QString filename); |
| 25 | void writeEigen(Eigen::MatrixXd X, QString filename); | 27 | void writeEigen(Eigen::MatrixXd X, QString filename); |
| 26 | void writeEigen(Eigen::VectorXd X, QString filename); | 28 | void writeEigen(Eigen::VectorXd X, QString filename); |
| @@ -40,6 +42,9 @@ Eigen::MatrixXf removeRowCol(const Eigen::MatrixXf X, int row, int col); | @@ -40,6 +42,9 @@ Eigen::MatrixXf removeRowCol(const Eigen::MatrixXf X, int row, int col); | ||
| 40 | Eigen::MatrixXf pointsToMatrix(const QList<QPointF> points, bool isAffine=false); | 42 | Eigen::MatrixXf pointsToMatrix(const QList<QPointF> points, bool isAffine=false); |
| 41 | QList<QPointF> matrixToPoints(const Eigen::MatrixXf P); | 43 | QList<QPointF> matrixToPoints(const Eigen::MatrixXf P); |
| 42 | 44 | ||
| 45 | +//Convert cv::Mat to Eigen | ||
| 46 | +Eigen::MatrixXf toEigen(const cv::Mat m); | ||
| 47 | + | ||
| 43 | template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> | 48 | template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> |
| 44 | inline QDataStream &operator<<(QDataStream &stream, const Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &mat) | 49 | inline QDataStream &operator<<(QDataStream &stream, const Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &mat) |
| 45 | { | 50 | { |
openbr/plugins/meta.cpp
| @@ -605,7 +605,7 @@ private: | @@ -605,7 +605,7 @@ private: | ||
| 605 | const QString file = getFileName(); | 605 | const QString file = getFileName(); |
| 606 | if (file.isEmpty()) return false; | 606 | if (file.isEmpty()) return false; |
| 607 | 607 | ||
| 608 | - if (Globals->verbose) qDebug("Loading %s", qPrintable(baseName)); | 608 | + if (Globals->verbose) qDebug("Loading %s", qPrintable(file)); |
| 609 | QByteArray data; | 609 | QByteArray data; |
| 610 | QtUtils::readFile(file, data, true); | 610 | QtUtils::readFile(file, data, true); |
| 611 | QDataStream stream(&data, QFile::ReadOnly); | 611 | QDataStream stream(&data, QFile::ReadOnly); |