Ejemplo n.º 1
0
        protected (int x, int y, int w, int h) Find(string screenName, string anchorName)
        {
            var(rectangle, _, _) = MatUtilities.Find(Mat, GetAnchor(screenName, anchorName));

            Log(mat => CvInvoke.Rectangle(mat, rectangle, new MCvScalar(0)), $"Find_{screenName}_{anchorName}");

            return(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
        }
Ejemplo n.º 2
0
        private static void IsExistsBaseTest(string screenName, string prefix)
        {
            foreach (var pair in GetImagesWithPrefix(Screenshots, prefix))
            {
                foreach (var(anchorName, anchor) in Info.GetAnchors(screenName, pair.Value.Size))
                {
                    var(rectangle, threshold, isExists) = MatUtilities.Find(pair.Value, anchor);
                    if (!isExists)
                    {
                        Assert.Warn($"!MatUtilities.IsExists: Anchor: {anchorName}. Image: {pair.Key}. Threshold: {threshold}. Edge threshold: {MatUtilities.IsExistsThreshold}");

                        using (var mat = pair.Value.Clone())
                        {
                            CvInvoke.Rectangle(mat, rectangle, new MCvScalar(0));
                            CvInvoke.Imshow("fail", mat);
                            CvInvoke.WaitKey();
                        }
                    }
                }
            }
        }