1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//src - https://bitbucket.org/rokill3r/imageprocessing/src/default/ImageProcessing/Form1.cs
//or https://rstforums.com/forum/topic/47812-c-finding-an-image-in-another-imageusing-aforge/
System.Drawing.Bitmap sourceImage = (Bitmap)Bitmap.FromFile(SourceInput.Text);
System.Drawing.Bitmap template = (Bitmap)Bitmap.FromFile(TempateInput.Text);
// create template matching algorithm's instance
// (set similarity threshold to 92.5%)
ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0.921f);
// find all matchings with specified above similarity
TemplateMatch[] matchings = tm.ProcessImage(sourceImage, template);
// highlight found matchings
BitmapData data = sourceImage.LockBits(
new Rectangle(0, 0, sourceImage.Width, sourceImage.Height),
ImageLockMode.ReadWrite, sourceImage.PixelFormat);
foreach (TemplateMatch m in matchings)
MessageBox.Show(m.Rectangle.Location.ToString());
sourceImage.UnlockBits(data);
ref - http://www.aforgenet.com/
todo : use CopyFromScreen (take a screenshot whole screen), find the target image to.
origin - https://www.pipiscrew.com/?p=18516 match-an-image-to-desktop-using-aforge-library