Commit d93507d9da8ca0d86028645224e920cef72035d6

Authored by caotto
2 parents 13375616 39dee1e8

Merge pull request #295 from biometrics/default_gallery

Discard templates on empty enroll output
Showing 1 changed file with 7 additions and 3 deletions
openbr/core/core.cpp
@@ -172,9 +172,10 @@ struct AlgorithmCore @@ -172,9 +172,10 @@ struct AlgorithmCore
172 qDebug("Enrolling %s%s", qPrintable(input.flat()), 172 qDebug("Enrolling %s%s", qPrintable(input.flat()),
173 gallery.isNull() ? "" : qPrintable(" to " + gallery.flat())); 173 gallery.isNull() ? "" : qPrintable(" to " + gallery.flat()));
174 174
  175 + bool noOutput = false;
175 if (gallery.name.isEmpty()) { 176 if (gallery.name.isEmpty()) {
176 if (input.name.isEmpty()) return; 177 if (input.name.isEmpty()) return;
177 - else gallery = getMemoryGallery(input); 178 + else noOutput = true;
178 } 179 }
179 180
180 bool multiProcess = Globals->file.getBool("multiProcess", false); 181 bool multiProcess = Globals->file.getBool("multiProcess", false);
@@ -200,12 +201,15 @@ struct AlgorithmCore @@ -200,12 +201,15 @@ struct AlgorithmCore
200 QString outputDesc; 201 QString outputDesc;
201 if (fileExclusion) 202 if (fileExclusion)
202 outputDesc = "FileExclusion(" + gallery.flat() + ")+"; 203 outputDesc = "FileExclusion(" + gallery.flat() + ")+";
203 - outputDesc.append("GalleryOutput("+gallery.flat()+")"); 204 + if (!noOutput)
  205 + outputDesc.append("GalleryOutput("+gallery.flat()+")+");
  206 +
  207 + outputDesc = outputDesc + "DiscardTemplates";
204 stages.append(progressCounter.data()); 208 stages.append(progressCounter.data());
205 209
206 QScopedPointer<Transform> pipeline(pipeTransforms(stages)); 210 QScopedPointer<Transform> pipeline(pipeTransforms(stages));
207 211
208 - QScopedPointer<Transform> stream(wrapTransform(pipeline.data(), "Stream(readMode=StreamGallery, endPoint="+outputDesc+"+DiscardTemplates)")); 212 + QScopedPointer<Transform> stream(wrapTransform(pipeline.data(), "Stream(readMode=StreamGallery, endPoint="+outputDesc+")"));
209 213
210 TemplateList data, output; 214 TemplateList data, output;
211 data.append(input); 215 data.append(input);