Emgu.CV.BinaryMatching
1.0.1
dotnet add package Emgu.CV.BinaryMatching --version 1.0.1
NuGet\Install-Package Emgu.CV.BinaryMatching -Version 1.0.1
<PackageReference Include="Emgu.CV.BinaryMatching" Version="1.0.1" />
<PackageVersion Include="Emgu.CV.BinaryMatching" Version="1.0.1" />
<PackageReference Include="Emgu.CV.BinaryMatching" />
paket add Emgu.CV.BinaryMatching --version 1.0.1
#r "nuget: Emgu.CV.BinaryMatching, 1.0.1"
#:package Emgu.CV.BinaryMatching@1.0.1
#addin nuget:?package=Emgu.CV.BinaryMatching&version=1.0.1
#tool nuget:?package=Emgu.CV.BinaryMatching&version=1.0.1
Emgu.CV.BinaryMatching
Emgu.CV.BinaryMatching is a high-performance C# library built on top of EmguCV, designed to perform template matching on binary images with rotation invariance. This library offers exceptional speed, making it suitable for real-time applications and capable of detecting multiple objects in an image.
Features
- Binary Image Template Matching: Specifically optimized for binary (black and white) images.
- Rotation Invariance: Detects objects regardless of their rotation angle.
- High Speed: Efficient implementation allows real-time processing.
- Multiple Object Detection: Capable of identifying more than one matching object in the image.
Requirements
- .NET Framework 4.6.1+
- Emgu.CV 4.9.0.5494+
- Emgu.CV.Bitmap 4.9.0.5494+
- Emgu.CV.runtime.windows 4.9.0.5494+
Installation
You can install Emgu.CV.BinaryMatching via NuGet:
Install-Package Emgu.CV.BinaryMatching -Version 1.0.1
Usage
Please set the build architecture to either "x86" or "x64". Do not set the architecture to "Any CPU". Here's a simple example demonstrating how to use the Emgu.CV.BinaryMatching library:
using Emgu.CV;
using Emgu.CV.BinaryMatching;
using Emgu.CV.CvEnum;
using System.Linq;
public class Example
{
public void DetectObject()
{
Mat src = CvInvoke.Imread("E:\\src.jpg", ImreadModes.Grayscale);
Mat templ = CvInvoke.Imread("E:\\template.jpg", ImreadModes.Grayscale);
Mat binarySrc = new Mat();
Mat binaryTempl = new Mat();
// Adjust the parameters appropriately.
CvInvoke.Threshold(src, binarySrc, 70, 255, ThresholdType.BinaryInv);
CvInvoke.Threshold(templ, binaryTempl, 70, 255, ThresholdType.BinaryInv);
CvInvoke.Imshow("binary src", binarySrc);
CvInvoke.Imshow("binary templ", binaryTempl);
/* Find one matched object
* "templScore" is MatchTemplate score
* "shapeScore" is MatShapes score*/
MatchedObject obj = FlatMatcher.FindOne(binarySrc, binaryTempl, templScore: 0.9, shapeScore: 0.1);
/* Or use Find if you want to find a maximum of 3 objects.
MatchedObject[] objs = FlatMatcher.Find(binarySrc, binaryTempl, count: 3, templScore: 0.9, shapeScore: 0.1);*/
Image<Bgr, byte> result = src.ToImage<Bgr, byte>();
if (obj != null)
{
// Draw the rotated rectangle.
System.Drawing.Point[] points = obj.RotatedRect.GetVertices().Select(pF => System.Drawing.Point.Round(pF)).ToArray();
CvInvoke.Polylines(result, points, true, new MCvScalar(0, 255, 0), 1, LineType.AntiAlias);
// Draw the center point.
System.Drawing.Point center = System.Drawing.Point.Round(obj.Center);
CvInvoke.Circle(result, center, 1, new MCvScalar(0, 255, 0), 1, LineType.AntiAlias);
// Draw the angle text (the angle difference from the template).
CvInvoke.PutText(result, obj.Angle.ToString("F1"), center, FontFace.HersheySimplex, 1, new MCvScalar(0,0,255), 1, LineType.AntiAlias);
}
CvInvoke.Imshow("result", result);
}
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.6.1
- Emgu.CV (>= 4.9.0.5494)
- Emgu.CV.Bitmap (>= 4.9.0.5494)
- Emgu.CV.runtime.windows (>= 4.9.0.5494)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
fix bugs