码迷,mamicode.com
首页 > 其他好文 > 详细

[Emgu]判断一张图片是否在另一张图片中

时间:2018-08-14 22:50:33      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:space   send   win   text   eve   hone   封装   demo1   style   

Emgu
  • Emgu是opencv视觉库在.net平台上的封装。
  • 可以通过以下IDE编译运行:Visual Studio, Xamarin Studio and Unity
  • 可以运行在Windows,、Linux、 Mac OS X、 iOS、 Android、Windows Phone系统上.
 
官网:
http://www.emgu.com/
 
示例代码1:判断一个图片是否在另一个图片中,存在返回去1,不存在返回0
using Emgu.CV;
using Emgu.CV.Structure;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EmguDemo1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //原图
            Image<Bgr, byte> source = new Image<Bgr, byte>(@"C:\emguDemo1\source.png");
            //子图
            Image<Bgr, byte> subPicPath = new Image<Bgr, byte>(@"C:\emguDemo1\subpic.JPG");

            //判断子图是否在原图中
            if(source.MatchTemplate(subPicPath, Emgu.CV.CvEnum.TemplateMatchingType.CcoeffNormed) != null)
            {
                MessageBox.Show("true");
            }
            else
            {
                MessageBox.Show("false");
            }
      
        }
    }
}

 

 

[Emgu]判断一张图片是否在另一张图片中

标签:space   send   win   text   eve   hone   封装   demo1   style   

原文地址:https://www.cnblogs.com/cooky/p/9478171.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!