C # OpenCvsharp template match
public static System.Drawing.Point FindPicFromImage(Mat srcMat, Mat dstMat, double threshold = 0.9)
{
OpenCvSharp.OutputArray outArray = null;
try
{
srcMat = srcMat.CvtColor(ColorConversionCodes.RGBA2RGB);
outArray = OpenCvSharp.OutputArray.Create(srcMat);
OpenCvSharp.Cv2.MatchTemplate(srcMat, dstMat, outArray, TemplateMatchModes.SqDiff);
double minValue, maxValue;
OpenCvSharp.Point location, point;
OpenCvSharp.Cv2.MinMaxLoc(OpenCvSharp.InputArray.Create(outArray.GetMat()), out minValue, out maxValue, out location, out point);
Console.WriteLine(maxValue);
if (maxValue >= threshold)
return new System.Drawing.Point(point.X, point.Y);
return System.Drawing.Point.Empty;
}
catch (Exception ex)
{
return System.Drawing.Point.Empty;
}
finally
{
}
}
C#, opencvsharp related questions The reason why C# VideoCapture cannot read the video: Custom picture Background subtraction, rotary gray diagram C# OPENCVSHARP Get the background picture Threshold F...
1. Overview This article records the image processing using the OpenCVSHARP package. Including two methods to enhance image contrast, zoom images, and delete transparent pixels. Second, conventional m...
using OpenCvSharp; using OpenCvSharp.Extensions; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.T...
Matching built-in arrays with function templates This is a point of knowledge I saw when I read the Matrix library related content in "Programming Principles and Practices (Second Edition) (Advan...
1. Cropped a piece as a template image on the original image, if the image is not cropping, the size is changed, affects the matching result. 2. Run the code 3. Results image  ...
1, first install OpenCvSharp, use cv2 function to get the device, and convert the image to Bitmap 2, open the thread when called, can be called within the main function, can also be called within the ...
1. What is OpenCVSharp In order to solve the problem of writing OpenCV programs under Csharp, I have done in-depth research and implemented a highly efficient method (GOCW); I have seen OpenCVSharp oc...
opencvsharp is a computer vision library for c#. Its functions are similar to opencv, but there are still some differences. It seems that there are no tutorials on this library on the Internet, but th...
The two most common ways to read pictures, personally prefer to use the former. These are several enumerations of imreadmodes. Just remember that the fourth one is converted to grayscale. For details,...
What is the characteristic of OpenCvsharp? Directly encapsulated more OpenCV methods, reducing the difficulty of learning, more convenient than Emgucv Most inherited the IDisposable interface for easy...