Commit 11bf404be3c50ec3435994e1f4a4ca4e329b9433

Authored by Josh Klontz
1 parent 760c7c00

added threshold value for #6

Showing 1 changed file with 4 additions and 1 deletions
sdk/plugins/output.cpp
@@ -156,6 +156,7 @@ class rrOutput : public MatrixOutput @@ -156,6 +156,7 @@ class rrOutput : public MatrixOutput
156 const bool index = file.getBool("index"); 156 const bool index = file.getBool("index");
157 const bool score = file.getBool("score"); 157 const bool score = file.getBool("score");
158 const bool invert = file.getBool("invert"); 158 const bool invert = file.getBool("invert");
  159 + const float threshold = file.getFloat("threshold", -std::numeric_limits<float>::max());
159 160
160 QStringList lines; 161 QStringList lines;
161 for (int i=0; i<queryFiles.size(); i++) { 162 for (int i=0; i<queryFiles.size(); i++) {
@@ -163,9 +164,11 @@ class rrOutput : public MatrixOutput @@ -163,9 +164,11 @@ class rrOutput : public MatrixOutput
163 if (!flat) files.append(queryFiles[i]); 164 if (!flat) files.append(queryFiles[i]);
164 165
165 typedef QPair<float,int> Pair; 166 typedef QPair<float,int> Pair;
166 - foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), !invert).mid(0, limit)) 167 + foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector(data.row(i)), !invert).mid(0, limit)) {
  168 + if (pair.second < threshold) break;
167 files.append((index ? QString::number(pair.second) : targetFiles[pair.second].name) + 169 files.append((index ? QString::number(pair.second) : targetFiles[pair.second].name) +
168 (score ? "=" + QString::number(pair.first) : "")); 170 (score ? "=" + QString::number(pair.first) : ""));
  171 + }
169 lines.append(files.join(flat ? "\n" : ",")); 172 lines.append(files.join(flat ? "\n" : ","));
170 } 173 }
171 174