private List<Match> findObjects(Bgr<byte>[,] image, out long preprocessTime, out long matchTime) { var grayIm = image.ToGray(); var bestRepresentatives = new List<Match>(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); linPyr = LinearizedMapPyramid.CreatePyramid(grayIm); //prepare linear-pyramid maps preprocessTime = stopwatch.ElapsedMilliseconds; stopwatch.Restart(); List<Match> matches = linPyr.MatchTemplates(templPyrs, threshold); stopwatch.Stop(); matchTime = stopwatch.ElapsedMilliseconds; var matchGroups = new MatchClustering(minDetectionsPerGroup).Group(matches.ToArray()); foreach (var group in matchGroups) { bestRepresentatives.Add(group.Representative); } return bestRepresentatives; }