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"); } } } }
原文:https://www.cnblogs.com/cooky/p/9478171.html