listCompare function
Compare target
to each image present in list
using a
specified algorithm
. If algorithm
is not specified, the default (PixelMatching())
is supplied.
Returns a Future list of doubles corresponding to the difference
between targetSrc
and srcListi
.
Output is in the same order as srcList
.
target
and listi
may be any combination of the supported types:
Implementation
Future<List<double>> listCompare({
required var target,
required List<dynamic> list,
Algorithm? algorithm,
}) async {
algorithm ??= PixelMatching(); //default algorithm
var results = List<double>.filled(list.length, 0);
await Future.wait(list.map((otherSrc) async {
results[list.indexOf(otherSrc)] =
await compareImages(src1: target, src2: otherSrc, algorithm: algorithm);
}));
return results;
}