示例#1
0
文件: UI.cs 项目: furaga/Magic2D_rev3
        //-----------------------------------------------------------------------------------------

        public float matching(IplImage ipl)
        {
            double  min_val = 0, max_val = 0;
            CvPoint min_loc = CvPoint.Empty, max_loc = CvPoint.Empty;

            return(TemplateMatching.Matching(ipl, 1f /*0.5*/, ref min_val, ref min_loc, ref max_val, ref max_loc));
        }
示例#2
0
文件: UI.cs 项目: furaga/Magic2D_rev3
        // 画像がスクリーンから消えるまで待機(ポーリング)
        public void waitVanish(IplImage tmpl, int timeout = 100, double threshold = -1)
        {
            timeout *= 1000;
            var sw = new Stopwatch();

            while (sw.ElapsedMilliseconds < timeout)
            {
                sw.Start();
                // 見つからなかったら脱出
                if (TemplateMatching.findTemplate(tmpl, threshold, false) == Rectangle.Empty)
                {
                    return;
                }
                sw.Stop();
            }
        }
示例#3
0
文件: UI.cs 项目: furaga/Magic2D_rev3
        //-----------------------------------------------------------------------------------------

        // 画像が見つかるまで待機(ポーリング)
        // timeoutが負数だったらタイムアウトしない
        public Rectangle wait(IplImage tmpl, int timeout = 100, double threshold = -1)
        {
            timeout *= 1000;
            var sw   = new Stopwatch();
            var rect = Rectangle.Empty;

            while (timeout < 0 || sw.ElapsedMilliseconds < timeout)
            {
                sw.Start();
                // 見つかったら脱出
                if ((rect = TemplateMatching.findTemplate(tmpl, threshold, false)) != Rectangle.Empty)
                {
                    break;
                }
                sw.Stop();
            }
            return(rect);
        }
示例#4
0
文件: UI.cs 项目: furaga/Magic2D_rev3
 public Rectangle find(IplImage tmpl, double threshold = -1)
 {
     return(TemplateMatching.findTemplate(tmpl, threshold, false));
 }
示例#5
0
文件: UI.cs 项目: furaga/Magic2D_rev3
        //-----------------------------------------------------------------------------------------

        // 指定された画像が存在するか
        public bool exist(IplImage tmpl, double threshold = -1)
        {
            return(TemplateMatching.findTemplate(tmpl, threshold, false) != Rectangle.Empty);
        }