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

Method pairwiseCompare

openbr/core/core.cpp:286–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284 }
285
286 void pairwiseCompare(File targetGallery, File queryGallery, File output)
287 {
288 qDebug("Pairwise comparing %s and %s%s", qPrintable(targetGallery.flat()),
289 qPrintable(queryGallery.flat()),
290 output.isNull() ? "" : qPrintable(" to " + output.flat()));
291
292 if (distance.isNull()) qFatal("Null distance.");
293
294 if (queryGallery == ".") queryGallery = targetGallery;
295
296 QScopedPointer<Gallery> t, q;
297 FileList targetFiles, queryFiles;
298 retrieveOrEnroll(targetGallery, t, targetFiles);
299 retrieveOrEnroll(queryGallery, q, queryFiles);
300
301 if (t->files().length() != q->files().length() )
302 qFatal("Dimension mismatch in pairwise compare");
303
304 TemplateList queries = q->read();
305 TemplateList targets = t->read();
306
307 output.set("targetGallery", targetGallery.name );
308 output.set("queryGallery", queryGallery.name );
309
310 // Use a single file for one of the dimensions so that the output makes the right size file
311 FileList dummyTarget;
312 dummyTarget.append(targets[0]);
313 QScopedPointer<Output> realOutput(Output::make(output, dummyTarget, queryFiles));
314
315 realOutput->set_blockRows(INT_MAX);
316 realOutput->set_blockCols(INT_MAX);
317 realOutput->setBlock(0,0);
318 for (int i=0; i < queries.length(); i++) {
319 float res = distance->compare(queries[i], targets[i]);
320 realOutput->setRelative(res, 0,i);
321 }
322 }
323
324 void deduplicate(const File &inputGallery, const File &outputGallery, const float threshold)
325 {

Callers 1

PairwiseCompareMethod · 0.80

Calls 11

makeFunction · 0.85
flatMethod · 0.80
lengthMethod · 0.80
isNullMethod · 0.45
filesMethod · 0.45
readMethod · 0.45
setMethod · 0.45
appendMethod · 0.45
setBlockMethod · 0.45
compareMethod · 0.45
setRelativeMethod · 0.45

Tested by

no test coverage detected