打赏

aforge通过角点匹配图片相似度

我不知道什么原因,人品不好还是啥的

ExhaustiveTemplateMatching这个类无法高精确度的匹配图片

...........

 

 

换一种方式,就好得多

/// <summary>
        /// 匹配结果
        /// </summary>
        /// <param name="src">来源</param>
        /// <param name="taget">模板</param>
        public static bool IsMatching(Bitmap src, Bitmap taget)
        {
            bool result=false;
            SusanCornersDetector scd = new SusanCornersDetector();
            if (CurTemplateFeaturePoint == null || CurTemplateFeaturePoint.Count == 0)
            {
                CurTemplateFeaturePoint = scd.ProcessImage(taget); //获取模板相关点
            }
            ExhaustiveBlockMatching bm = new ExhaustiveBlockMatching(5, 5);
            bm.SimilarityThreshold = 0.9f;
            // 搜索匹配点
            List<BlockMatch> matches = bm.ProcessImage(taget, CurTemplateFeaturePoint, src);
            int sourceCount = CurTemplateFeaturePoint.Count;
            int matchCount = matches.Count;
            double matchPercent = Math.Round(matchCount/(sourceCount+0F), 2);
            if (matchPercent>=StcVar.FfSimilarityThreshold)
            {
                result = true;
            }
            src.Dispose();
            taget.Dispose();
            return result;
        }

 

posted @ 2016-11-15 14:57  Bear.Tirisfal  阅读(1843)  评论(1编辑  收藏  举报