Commit b89cf44866a59fcccdaafa34d24286e2291711a1

Authored by Scott Klum
1 parent 8b0ed18e

Fixed rankOutput to work with non-self identity masks

Showing 1 changed file with 4 additions and 2 deletions
sdk/plugins/output.cpp
@@ -271,7 +271,8 @@ class rankOutput : public MatrixOutput @@ -271,7 +271,8 @@ class rankOutput : public MatrixOutput
271 if (targetFiles.isEmpty() || queryFiles.isEmpty()) return; 271 if (targetFiles.isEmpty() || queryFiles.isEmpty()) return;
272 272
273 QList<int> ranks; 273 QList<int> ranks;
274 - QList<double> scores; 274 + QList<int> positions;
  275 + QList<float> scores;
275 QStringList lines; 276 QStringList lines;
276 277
277 for (int i=0; i<queryFiles.size(); i++) { 278 for (int i=0; i<queryFiles.size(); i++) {
@@ -280,6 +281,7 @@ class rankOutput : public MatrixOutput @@ -280,6 +281,7 @@ class rankOutput : public MatrixOutput
280 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)) {
281 if(targetFiles[pair.second].label() == queryFiles[i].label()) { 282 if(targetFiles[pair.second].label() == queryFiles[i].label()) {
282 ranks.append(rank); 283 ranks.append(rank);
  284 + positions.append(pair.second);
283 scores.append(pair.first); 285 scores.append(pair.first);
284 break; 286 break;
285 } 287 }
@@ -289,7 +291,7 @@ class rankOutput : public MatrixOutput @@ -289,7 +291,7 @@ class rankOutput : public MatrixOutput
289 291
290 typedef QPair<int,int> RankPair; 292 typedef QPair<int,int> RankPair;
291 foreach (const RankPair &pair, Common::Sort(ranks, false)) 293 foreach (const RankPair &pair, Common::Sort(ranks, false))
292 - lines.append(queryFiles[pair.second].name + " " + QString::number(pair.first) + " " + QString::number(scores[pair.second]) + " " + targetFiles[pair.second].name); 294 + lines.append(queryFiles[pair.second].name + " " + QString::number(pair.first) + " " + QString::number(scores[pair.second]) + " " + targetFiles[positions[pair.second]].name);
293 295
294 QtUtils::writeFile(file, lines); 296 QtUtils::writeFile(file, lines);
295 } 297 }