private void ApplySURF() { List <VectorOfKeyPoint> keyPointsList; SURFDetector surfCPU; Tuple <Image <Bgr, byte>, HomographyMatrix> homo1; Tuple <Image <Bgr, byte>, Rectangle, double> tup; Stopwatch watch = Stopwatch.StartNew(); Image <Bgr, Byte> pTest; Tuple <Image <Bgr, byte>, float[]> drawResult = null; ArrayList allMatches = new ArrayList(); int x, y, counter; string[] filePaths = Directory.GetFiles(_intermediatePath, "*.jpg"); foreach (string path in filePaths) { GetImageParameters(out x, out y, out counter, path); pTest = new Image <Bgr, byte>(path); keyPointsList = _descriptor.SURF_BruteForceMatcher(_gElement, pTest.Convert <Gray, Byte>(), _hessianThreshould, out surfCPU); homo1 = _machineLearning.SURFMatcher_KNN(_gElement, pTest.Convert <Gray, Byte>(), surfCPU, keyPointsList, _uniquenessThresh, _tm); drawResult = _machineLearning.ApplyHistogramMatching(out tup, homo1, _gElement, pTest.Convert <Gray, Byte>(), _test, _inputPath, counter, x, y, _histogramMatchingScore); if (drawResult != null) { if (drawResult.Item2[2] > 0) { allMatches.Add(drawResult.Item2); _log.WriteLine(string.Format("\n\tSW2 location: ({0}, {1})\n\tHistogram score: {2}]", drawResult.Item2[0], drawResult.Item2[1], drawResult.Item2[2])); } } } if (allMatches != null) { _log.WriteLine("The count before consolidation: " + allMatches.Count); //////// Consolidate //HashSet<float[]> hash0 = Consolidation.Consolidate(allMatches, _gElement.Width - 1, _gElement.Height - 1, _log); //ArrayList al = new ArrayList(); //foreach (float[] i in hash0) // al.Add(i); //HashSet<float[]> hash = Consolidation.Consolidate(al, _gElement.Width - 1, _gElement.Height - 1, _log); ///////Drawing //_log.WriteLine("The count after consolidation: " + hash.Count); //Visualization.DrawingResults(hash, _gElement, _test, _inputPath); Visualization.DrawingResults(allMatches, _gElement, _test, _inputPath); } watch.Stop(); _log.WriteLine(watch.Elapsed); _log.Close(); }