public IDictionary<object, Rectangle[]> FindAllMatches(Image<Bgr, Byte> source, string match = "", bool copy = true, string ignore = "") // todo: proper order
{
var matches = new ConcurrentDictionary<object, Rectangle[]>();
Image<Bgr, Byte> sourceImage = copy ? source.Copy() : source;
foreach (KeyValuePair<object, Image<Bgr, Byte>> subImageKeyValuePair in SubImages)
{
if (match.Length > 0 && !subImageKeyValuePair.Key.ToString().Contains(match)) continue;
if (ignore.Length > 0 && subImageKeyValuePair.Key.ToString().Contains(ignore)) continue;
Rectangle[] subImageMatches = FindMatches(sourceImage, subImageKeyValuePair.Value, copy);
matches[subImageKeyValuePair.Key] = subImageMatches;
}
/*Parallel.ForEach(SubImages, (subImageKeyValuePair) =>
{
if (match.Length > 0 && !subImageKeyValuePair.Key.ToString().Contains(match)) return;
if (ignore.Length > 0 && subImageKeyValuePair.Key.ToString().Contains(ignore)) return;
Rectangle[] subImageMatches = FindMatches(sourceImage, subImageKeyValuePair.Value, copy);
matches[subImageKeyValuePair.Key] = subImageMatches;
//matches.Add(subImageKeyValuePair.Key, subImageMatches);
});*/
return matches;
}