public IEnumerable <Match> FindMatches(IPattern Template, double Similarity)
        {
            using var result = new DisposableMat();

            // max is used for tmccoeff
            Imgproc.MatchTemplate(Mat, (Template as DroidCvPattern)?.Mat, result.Mat, Imgproc.TmCcoeffNormed);

            Imgproc.Threshold(result.Mat, result.Mat, 0.1, 1, Imgproc.ThreshTozero);

            while (true)
            {
                using var minMaxLocResult = Core.MinMaxLoc(result.Mat);
                var score = minMaxLocResult.MaxVal;

                if (score >= Similarity)
                {
                    var loc    = minMaxLocResult.MaxLoc;
                    var region = new Region((int)loc.X, (int)loc.Y, Template.Width, Template.Height);

                    yield return(new Match(region, score));

                    using var mask = new DisposableMat();
                    // Flood fill eliminates the problem of nearby points to a high similarity point also having high similarity
                    const double floodFillDiff = 0.05;
                    Imgproc.FloodFill(result.Mat, mask.Mat, loc, new Scalar(0),
                                      new Rect(),
                                      new Scalar(floodFillDiff), new Scalar(floodFillDiff),
                                      0);
                }
                else
                {
                    break;
                }
            }
        }