MCPcopy Create free account
hub / github.com/biometrics/openbr / enroll

Method enroll

openbr/core/core.cpp:186–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184 }
185
186 void enroll(File input, File gallery = File())
187 {
188 bool noOutput = false;
189 if (gallery.name.isEmpty()) {
190 if (input.name.isEmpty()) return;
191 else noOutput = true;
192 }
193
194 bool multiProcess = Globals->file.getBool("multiProcess", false);
195 bool fileExclusion = false;
196
197 // In append mode, we will exclude any templates with filenames already present in the output gallery
198 if (gallery.contains("append") && gallery.exists() ) {
199 FileList::fromGallery(gallery,true);
200 fileExclusion = true;
201 }
202
203 Transform *enroll = simplifiedTransform.data();
204
205 if (multiProcess)
206 enroll = wrapTransform(enroll, "ProcessWrapper");
207
208 QList<Transform *> stages;
209 stages.append(enroll);
210
211 QString outputDesc;
212 if (fileExclusion)
213 outputDesc = "FileExclusion(" + gallery.flat() + ")+";
214 if (!noOutput)
215 outputDesc.append("GalleryOutput("+gallery.flat()+")+");
216
217 outputDesc = outputDesc + "DiscardTemplates";
218 stages.append(progressCounter.data());
219
220 QScopedPointer<Transform> pipeline(pipeTransforms(stages));
221 QScopedPointer<Transform> stream(wrapTransform(pipeline.data(), "Stream(readMode=StreamGallery, endPoint="+outputDesc+")"));
222
223 foreach (const br::File &file, input.split()) {
224 qDebug("Enrolling %s%s", qPrintable(file.name),
225 gallery.isNull() ? "" : qPrintable(" to " + gallery.flat()));
226
227 Gallery *temp = Gallery::make(file);
228 qint64 total = temp->totalSize();
229 delete temp;
230
231 progressCounter->setPropertyRecursive("totalProgress", QString::number(total));
232
233 TemplateList data, output;
234 data.append(file);
235
236 stream->projectUpdate(data, output);
237 }
238
239 if (multiProcess)
240 delete enroll;
241 }
242
243 void project(File input, File output)

Callers 1

EnrollMethod · 0.45

Calls 8

FileFunction · 0.85
isEmptyMethod · 0.80
getBoolMethod · 0.80
flatMethod · 0.80
containsMethod · 0.45
dataMethod · 0.45
appendMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected