OpenCvSharp.Cv2.MatchTemplate C# (CSharp) Method

MatchTemplate() public static method

Computes the proximity map for the raster template and the image where the template is searched for
public static MatchTemplate ( InputArray image, InputArray templ, OutputArray result, TemplateMatchModes method, InputArray mask = null ) : void
image InputArray Image where the search is running; should be 8-bit or 32-bit floating-point
templ InputArray Searched template; must be not greater than the source image and have the same data type
result OutputArray A map of comparison results; will be single-channel 32-bit floating-point. /// If image is WxH and templ is wxh then result will be (W-w+1) x (H-h+1).
method TemplateMatchModes Specifies the comparison method
mask InputArray Mask of searched template. It must have the same datatype and size with templ. It is not set by default.
return void
        public static void MatchTemplate(
            InputArray image, 
            InputArray templ,
            OutputArray result,
            TemplateMatchModes method, 
            InputArray mask = null)
        {
            if (image == null)
                throw new ArgumentNullException(nameof(image));
            if (templ == null)
                throw new ArgumentNullException(nameof(templ));
            if (result == null)
                throw new ArgumentNullException(nameof(result));
            image.ThrowIfDisposed();
            templ.ThrowIfDisposed();
            result.ThrowIfNotReady();
            if (mask != null)
                mask.ThrowIfDisposed();
            NativeMethods.imgproc_matchTemplate(image.CvPtr, templ.CvPtr, result.CvPtr, (int)method, ToPtr(mask));
            GC.KeepAlive(image);
            GC.KeepAlive(templ);
            result.Fix();
            GC.KeepAlive(mask);
        }
        #endregion
Cv2