UtilAForgeMatchImage(String, String, Single) Method
Matches a part of an image inside of the specified source image,
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(
string srcImagePath,
string findImagePath,
float similarity
)
Public Shared Function MatchImage (
srcImagePath As String,
findImagePath As String,
similarity As Single
) As TemplateMatch()
Dim srcImagePath As String
Dim findImagePath As String
Dim similarity As Single
Dim returnValue As TemplateMatch()
returnValue = UtilAForge.MatchImage(srcImagePath,
findImagePath, similarity)
public:
static array<TemplateMatch^>^ MatchImage(
String^ srcImagePath,
String^ findImagePath,
float similarity
)
static member MatchImage :
srcImagePath : string *
findImagePath : string *
similarity : float32 -> TemplateMatch[]
No code example is currently available or this language may not be supported.
- srcImagePath String
-
The filepath of the source image.
- findImagePath String
-
The filepath of the image to find inside srcImagePath image.
- similarity Single
-
The similarity percentage threshold to compare the images.
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.
' A desktop screenshot, in 1920x1080 px. resolution.
Dim desktopScreenshot As String = "C:\Desktop.png"
' A cutted piece of the screenshot, in 50x50 px. resolution.
Dim partOfDesktopToFind As String = "C:\PieceOfDesktop.png"
' Match part of the image in the desktop, with the specified similarity threeshold.
Dim matches As TemplateMatch() = MatchImage(srcImagePath:=desktopScreenshot,
findImagePath:=partOfDesktopToFind,
similarity:=80.5F) ' 80,5% similarity threeshold.
For Each match As TemplateMatch In matches
Dim sb As New System.Text.StringBuilder
sb.AppendFormat("Top-Left Corner Coordinates: {0}", match.Rectangle.Location.ToString())
sb.AppendLine()
sb.AppendFormat("Similarity Image Percentage: {0}%", (match.Similarity * 100.0F).ToString("00.00"))
MessageBox.Show(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.
ArgumentOutOfRangeException
|
similarity
|