UtilAForgeMatchImage(Bitmap, Bitmap, 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(
Bitmap srcImage,
Bitmap findImage,
float similarity
)
Public Shared Function MatchImage (
srcImage As Bitmap,
findImage As Bitmap,
similarity As Single
) As TemplateMatch()
Dim srcImage As Bitmap
Dim findImage As Bitmap
Dim similarity As Single
Dim returnValue As TemplateMatch()
returnValue = UtilAForge.MatchImage(srcImage,
findImage, similarity)
public:
static array<TemplateMatch^>^ MatchImage(
Bitmap^ srcImage,
Bitmap^ findImage,
float similarity
)
static member MatchImage :
srcImage : Bitmap *
findImage : Bitmap *
similarity : float32 -> TemplateMatch[]
No code example is currently available or this language may not be supported.
- srcImage Bitmap
-
The source image.
- findImage Bitmap
-
The image to find inside srcImage 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 New Bitmap("C:\Desktop.png")
' A cutted piece of the screenshot, in 50x50 px. resolution.
Dim partOfDesktopToFind As New Bitmap("C:\PieceOfDesktop.png")
' Match part of the image in the desktop, with the specified similarity threeshold.
Dim matches As TemplateMatch() = MatchImage(srcImage:=desktopScreenshot,
findImage:=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
|