Commit e19e4805e0627694629ec54ad8e41bc5b51d614b

Authored by Scott Klum
2 parents 0fe1acc2 c950d180

Merge branch 'master' of https://github.com/biometrics/openbr

sdk/core/bee.cpp
@@ -112,25 +112,32 @@ template <typename T> @@ -112,25 +112,32 @@ template <typename T>
112 Mat readMatrix(const br::File &matrix) 112 Mat readMatrix(const br::File &matrix)
113 { 113 {
114 // Special case matrix construction 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 if (sizeof(T) == sizeof(BEE::Mask_t)) { 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 m.setTo(BEE::NonMatch); 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 for (int j=0; j<step; j++) 133 for (int j=0; j<step; j++)
127 for (int k=0; k<step; k++) 134 for (int k=0; k<step; k++)
128 m.at<BEE::Mask_t>(i+j,i+k) = ((selfSimilar && (j == k)) ? BEE::DontCare : BEE::Match); 135 m.at<BEE::Mask_t>(i+j,i+k) = ((selfSimilar && (j == k)) ? BEE::DontCare : BEE::Match);
129 return m; 136 return m;
130 } else if (sizeof(T) == sizeof(BEE::Simmat_t)) { 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 for (int j=0; j<step; j++) 141 for (int j=0; j<step; j++)
135 for (int k=0; k<step; k++) 142 for (int k=0; k<step; k++)
136 m.at<BEE::Simmat_t>(i+j,i+k) = 1; 143 m.at<BEE::Simmat_t>(i+j,i+k) = 1;
@@ -140,7 +147,7 @@ Mat readMatrix(const br::File &amp;matrix) @@ -140,7 +147,7 @@ Mat readMatrix(const br::File &amp;matrix)
140 147
141 QFile file(matrix); 148 QFile file(matrix);
142 bool success = file.open(QFile::ReadOnly); 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 // Check format 152 // Check format
146 QByteArray format = file.readLine(); 153 QByteArray format = file.readLine();
@@ -164,7 +171,7 @@ Mat readMatrix(const br::File &amp;matrix) @@ -164,7 +171,7 @@ Mat readMatrix(const br::File &amp;matrix)
164 file.close(); 171 file.close();
165 172
166 Mat result; 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 else result = m.clone(); 175 else result = m.clone();
169 return result; 176 return result;
170 } 177 }
sdk/core/plot.cpp
@@ -118,9 +118,11 @@ float Evaluate(const QString &amp;simmat, const QString &amp;mask, const QString &amp;csv) @@ -118,9 +118,11 @@ float Evaluate(const QString &amp;simmat, const QString &amp;mask, const QString &amp;csv)
118 118
119 // Read files 119 // Read files
120 const Mat scores = BEE::readSimmat(simmat); 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 const Mat masks = BEE::readMask(maskFile); 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 // Make comparisons 127 // Make comparisons
126 QList<Comparison> comparisons; comparisons.reserve(scores.rows*scores.cols); 128 QList<Comparison> comparisons; comparisons.reserve(scores.rows*scores.cols);
sdk/plugins/ct8.cmake
@@ -7,10 +7,16 @@ if(${BR_WITH_CT8}) @@ -7,10 +7,16 @@ if(${BR_WITH_CT8})
7 set(CT8_LIBS optimized ${CT8_LIBRARY_RELEASE} debug ${CT8_LIBRARY_DEBUG}) 7 set(CT8_LIBS optimized ${CT8_LIBRARY_RELEASE} debug ${CT8_LIBRARY_DEBUG})
8 set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${CT8_LIBS}) 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 install(FILES ${CT8_DIR_LIB}/libfrsdk-8.5.0.so 17 install(FILES ${CT8_DIR_LIB}/libfrsdk-8.5.0.so
11 ${CT8_DIR_LIB}/../share/libhasp_linux_x86_64_67109.so 18 ${CT8_DIR_LIB}/../share/libhasp_linux_x86_64_67109.so
12 ${CT8_DIR_LIB}/../share/libiomp5.so 19 ${CT8_DIR_LIB}/../share/libiomp5.so
13 DESTINATION lib) 20 DESTINATION lib)
14 - install(DIRECTORY ${CT8_DIR}/etc DESTINATION models/ct8)  
15 - add_definitions(-DCT8_DIR=\"${CT8_DIR}\") 21 + endif()
16 endif() 22 endif()
sdk/plugins/ct8.cpp
@@ -418,9 +418,8 @@ struct CT8Enroll : public UntrainableTransform @@ -418,9 +418,8 @@ struct CT8Enroll : public UntrainableTransform
418 if (!enroll_succeeded) 418 if (!enroll_succeeded)
419 { 419 {
420 dst.file.setBool("FTE"); 420 dst.file.setBool("FTE");
421 - return; 421 + dst.m() = Mat();
422 } 422 }
423 -  
424 } catch (std::exception &e) { 423 } catch (std::exception &e) {
425 qFatal("CT8Enroll Exception: %s", e.what()); 424 qFatal("CT8Enroll Exception: %s", e.what());
426 } 425 }
sdk/plugins/output.cpp
@@ -279,7 +279,7 @@ class rankOutput : public MatrixOutput @@ -279,7 +279,7 @@ class rankOutput : public MatrixOutput
279 typedef QPair<float,int> Pair; 279 typedef QPair<float,int> Pair;
280 int rank = 1; 280 int rank = 1;
281 foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), true)) { 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 ranks.append(rank); 283 ranks.append(rank);
284 positions.append(pair.second); 284 positions.append(pair.second);
285 scores.append(pair.first); 285 scores.append(pair.first);