Commit e19e4805e0627694629ec54ad8e41bc5b51d614b
Merge branch 'master' of https://github.com/biometrics/openbr
Showing
5 changed files
with
33 additions
and
19 deletions
sdk/core/bee.cpp
| ... | ... | @@ -112,25 +112,32 @@ template <typename T> |
| 112 | 112 | Mat readMatrix(const br::File &matrix) |
| 113 | 113 | { |
| 114 | 114 | // Special case matrix construction |
| 115 | - if (matrix == "Matrix") { | |
| 116 | - const int size = matrix.getInt("Size"); | |
| 117 | - const int step = matrix.getInt("Step", 1); | |
| 118 | - if (size % step != 0) qFatal("Step does not divide size evenly."); | |
| 115 | + if (matrix == "Identity") { | |
| 116 | + int rows = matrix.getInt("rows", -1); | |
| 117 | + int columns = matrix.getInt("columns", -1); | |
| 118 | + const int size = matrix.getInt("size", -1); | |
| 119 | + if (size != -1) { | |
| 120 | + if (rows == -1) rows = size; | |
| 121 | + if (columns == -1) columns = size; | |
| 122 | + } | |
| 123 | + const int step = matrix.getInt("step", 1); | |
| 124 | + if (rows % step != 0) qFatal("Step does not divide rows evenly."); | |
| 125 | + if (columns % step != 0) qFatal("Step does not divide columns evenly."); | |
| 119 | 126 | |
| 120 | 127 | if (sizeof(T) == sizeof(BEE::Mask_t)) { |
| 121 | - const bool selfSimilar = matrix.getBool("SelfSimilar"); | |
| 128 | + const bool selfSimilar = matrix.getBool("selfSimilar"); | |
| 122 | 129 | |
| 123 | - Mat m(size, size, CV_8UC1); | |
| 130 | + Mat m(rows, columns, CV_8UC1); | |
| 124 | 131 | m.setTo(BEE::NonMatch); |
| 125 | - for (int i=0; i<size; i+=step) | |
| 132 | + for (int i=0; i<std::min(rows, columns); i+=step) | |
| 126 | 133 | for (int j=0; j<step; j++) |
| 127 | 134 | for (int k=0; k<step; k++) |
| 128 | 135 | m.at<BEE::Mask_t>(i+j,i+k) = ((selfSimilar && (j == k)) ? BEE::DontCare : BEE::Match); |
| 129 | 136 | return m; |
| 130 | 137 | } else if (sizeof(T) == sizeof(BEE::Simmat_t)) { |
| 131 | - Mat m(size, size, CV_32FC1); | |
| 132 | - m.setTo(BEE::NonMatch); | |
| 133 | - for (int i=0; i<size; i+=step) | |
| 138 | + Mat m(rows, columns, CV_32FC1); | |
| 139 | + m.setTo(0); | |
| 140 | + for (int i=0; i<std::min(rows, columns); i+=step) | |
| 134 | 141 | for (int j=0; j<step; j++) |
| 135 | 142 | for (int k=0; k<step; k++) |
| 136 | 143 | m.at<BEE::Simmat_t>(i+j,i+k) = 1; |
| ... | ... | @@ -140,7 +147,7 @@ Mat readMatrix(const br::File &matrix) |
| 140 | 147 | |
| 141 | 148 | QFile file(matrix); |
| 142 | 149 | bool success = file.open(QFile::ReadOnly); |
| 143 | - if (!success) qFatal("Unable to open %s for reading.", qPrintable((QString)matrix)); | |
| 150 | + if (!success) qFatal("Unable to open %s for reading.", qPrintable(matrix.name)); | |
| 144 | 151 | |
| 145 | 152 | // Check format |
| 146 | 153 | QByteArray format = file.readLine(); |
| ... | ... | @@ -164,7 +171,7 @@ Mat readMatrix(const br::File &matrix) |
| 164 | 171 | file.close(); |
| 165 | 172 | |
| 166 | 173 | Mat result; |
| 167 | - if (isDistance ^ matrix.getBool("Negate")) m.convertTo(result, -1, -1); | |
| 174 | + if (isDistance ^ matrix.getBool("negate")) m.convertTo(result, -1, -1); | |
| 168 | 175 | else result = m.clone(); |
| 169 | 176 | return result; |
| 170 | 177 | } | ... | ... |
sdk/core/plot.cpp
| ... | ... | @@ -118,9 +118,11 @@ float Evaluate(const QString &simmat, const QString &mask, const QString &csv) |
| 118 | 118 | |
| 119 | 119 | // Read files |
| 120 | 120 | const Mat scores = BEE::readSimmat(simmat); |
| 121 | - File maskFile(mask); maskFile.insert("Size", scores.rows); | |
| 121 | + File maskFile(mask); | |
| 122 | + maskFile.insert("rows", scores.rows); | |
| 123 | + maskFile.insert("columns", scores.cols); | |
| 122 | 124 | const Mat masks = BEE::readMask(maskFile); |
| 123 | - if (scores.size() != masks.size()) qFatal("Simmat/Mask size mismatch."); | |
| 125 | + if (scores.size() != masks.size()) qFatal("Simmat %i /Mask %i size mismatch.", scores.size(), mask.size()); | |
| 124 | 126 | |
| 125 | 127 | // Make comparisons |
| 126 | 128 | QList<Comparison> comparisons; comparisons.reserve(scores.rows*scores.cols); | ... | ... |
sdk/plugins/ct8.cmake
| ... | ... | @@ -7,10 +7,16 @@ if(${BR_WITH_CT8}) |
| 7 | 7 | set(CT8_LIBS optimized ${CT8_LIBRARY_RELEASE} debug ${CT8_LIBRARY_DEBUG}) |
| 8 | 8 | set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${CT8_LIBS}) |
| 9 | 9 | |
| 10 | + | |
| 11 | + if(WIN32) | |
| 12 | + install(FILES ${CT8_DIR_LIB}/libfrsdk-8.6.0.dll | |
| 13 | + DESTINATION bin) | |
| 14 | + install(DIRECTORY ${CT8_DIR}/etc DESTINATION models/ct8) | |
| 15 | + add_definitions(-DCT8_DIR=\"${CT8_DIR}\") | |
| 16 | + else() | |
| 10 | 17 | install(FILES ${CT8_DIR_LIB}/libfrsdk-8.5.0.so |
| 11 | 18 | ${CT8_DIR_LIB}/../share/libhasp_linux_x86_64_67109.so |
| 12 | 19 | ${CT8_DIR_LIB}/../share/libiomp5.so |
| 13 | 20 | DESTINATION lib) |
| 14 | - install(DIRECTORY ${CT8_DIR}/etc DESTINATION models/ct8) | |
| 15 | - add_definitions(-DCT8_DIR=\"${CT8_DIR}\") | |
| 21 | + endif() | |
| 16 | 22 | endif() | ... | ... |
sdk/plugins/ct8.cpp
| ... | ... | @@ -418,9 +418,8 @@ struct CT8Enroll : public UntrainableTransform |
| 418 | 418 | if (!enroll_succeeded) |
| 419 | 419 | { |
| 420 | 420 | dst.file.setBool("FTE"); |
| 421 | - return; | |
| 421 | + dst.m() = Mat(); | |
| 422 | 422 | } |
| 423 | - | |
| 424 | 423 | } catch (std::exception &e) { |
| 425 | 424 | qFatal("CT8Enroll Exception: %s", e.what()); |
| 426 | 425 | } | ... | ... |
sdk/plugins/output.cpp
| ... | ... | @@ -279,7 +279,7 @@ class rankOutput : public MatrixOutput |
| 279 | 279 | typedef QPair<float,int> Pair; |
| 280 | 280 | int rank = 1; |
| 281 | 281 | foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), true)) { |
| 282 | - if(targetFiles[pair.second].label() == queryFiles[i].label()) { | |
| 282 | + if(targetFiles[pair.second].getString("Label") == queryFiles[i].getString("Label")) { | |
| 283 | 283 | ranks.append(rank); |
| 284 | 284 | positions.append(pair.second); |
| 285 | 285 | scores.append(pair.first); | ... | ... |