Commit b9c9e19b60b740fdee7db3a50d923b86ad4e7d76
Merge branch 'master' of https://github.com/biometrics/openbr
Showing
4 changed files
with
15 additions
and
6 deletions
sdk/core/core.cpp
| ... | ... | @@ -116,7 +116,7 @@ struct AlgorithmCore |
| 116 | 116 | return fileList; // Already enrolled |
| 117 | 117 | |
| 118 | 118 | const TemplateList i(TemplateList::fromInput(input)); |
| 119 | - if (i.isEmpty()) return FileList(); // Nothing to enroll | |
| 119 | + if (i.isEmpty()) return fileList; // Nothing to enroll | |
| 120 | 120 | |
| 121 | 121 | if (transform.isNull()) qFatal("AlgorithmCore::enroll null transform."); |
| 122 | 122 | const int blocks = Globals->blocks(i.size()); | ... | ... |
sdk/plugins/output.cpp
| ... | ... | @@ -150,6 +150,7 @@ class rrOutput : public MatrixOutput |
| 150 | 150 | const bool index = file.getBool("index"); |
| 151 | 151 | const bool score = file.getBool("score"); |
| 152 | 152 | const bool invert = file.getBool("invert"); |
| 153 | + const bool metadata = file.getBool("metadata"); | |
| 153 | 154 | const float threshold = file.getFloat("threshold", -std::numeric_limits<float>::max()); |
| 154 | 155 | |
| 155 | 156 | QStringList lines; |
| ... | ... | @@ -159,9 +160,17 @@ class rrOutput : public MatrixOutput |
| 159 | 160 | |
| 160 | 161 | typedef QPair<float,int> Pair; |
| 161 | 162 | foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), !invert).mid(0, limit)) { |
| 162 | - if (pair.second < threshold) break; | |
| 163 | - files.append((index ? QString::number(pair.second) : targetFiles[pair.second].name) + | |
| 164 | - (score ? "=" + QString::number(pair.first) : "")); | |
| 163 | + if (pair.first < threshold) break; | |
| 164 | + QString output; | |
| 165 | + output.append((index ? QString::number(pair.second) : targetFiles[pair.second].name) + | |
| 166 | + (score ? "=" + QString::number(pair.first) : "")); | |
| 167 | + if (metadata) { | |
| 168 | + foreach (const QString &key, targetFiles[pair.second].localKeys()) { | |
| 169 | + const QString value = targetFiles[pair.second].getString(key, ""); | |
| 170 | + output.append("," + key + "=" + value); | |
| 171 | + } | |
| 172 | + } | |
| 173 | + files.append(output); | |
| 165 | 174 | } |
| 166 | 175 | lines.append(files.join(flat ? "\n" : ",")); |
| 167 | 176 | } | ... | ... |