UtilAForgeMatchImage(IntPtr, Image, Single) Method
Matches a part of an image in the specified window,
and returns the relative top-left corner coordinates of any matched image and their similarity percent.
Namespace: DevCase.ThirdParty.AForgeAssembly: DevCase.net48.ThirdParty.AForge (in DevCase.net48.ThirdParty.AForge.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static TemplateMatch[] MatchImage(
IntPtr hWnd,
Image findImage,
float similarity
)
Public Shared Function MatchImage (
hWnd As IntPtr,
findImage As Image,
similarity As Single
) As TemplateMatch()
Dim hWnd As IntPtr
Dim findImage As Image
Dim similarity As Single
Dim returnValue As TemplateMatch()
returnValue = UtilAForge.MatchImage(hWnd,
findImage, similarity)
public:
static array<TemplateMatch^>^ MatchImage(
IntPtr hWnd,
Image^ findImage,
float similarity
)
static member MatchImage :
hWnd : IntPtr *
findImage : Image *
similarity : float32 -> TemplateMatch[]
No code example is currently available or this language may not be supported.
- hWnd IntPtr
-
A handle to the source window.
- findImage Image
-
The image to find.
- similarity Single
-
The similarity percentage threshold to compare the image.
A value of 100 means find a 100% identical image.
Note: High percentage values with images of big resolutions could take several minutes to accomplish.
TemplateMatch
An Array of
TemplateMatch that contains the
relative top-left corner coordinates of any matched image and their similarity percent.
This is a code example.
No code example is currently available or this language may not be supported.
Dim hWnd As IntPtr = Process.GetCurrentProcess().MainWindowHandle
Dim findImage As New Bitmap("C:\Image.png")
Dim matches As TemplateMatch() = MatchImage(hWnd, findImage, 80.5F) ' 80,5% similarity threeshold.
For Each match As TemplateMatch In matches
Dim sb As New StringBuilder()
sb.AppendFormat("Client Coordinates: {0}", match.Rectangle.Location.ToString())
sb.AppendFormat("Screen Coordinates: {0}", DevCase.ThirdParty.AForge.Extensions.TemplateMatch.ToScreenCoordinates(match, hWnd).Location.ToString())
sb.AppendFormat("Similarity Image Percentage: {0}%", (match.Similarity * 100.0F).ToString("00.00"))
sb.AppendLine()
Console.WriteLine(sb.ToString())
Next match
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.