OpenCvSharp (C# OpenCV) Template matching skills and demonstration with mask (with source code)

Click the card below to follow the public account of " OpenCV and AI Deep Learning "!

Visual/image heavy dry goods, delivered as soon as possible!

foreword

For specific steps and ideas, please refer to the following articles:

Actual combat | OpenCV template matching skills and demonstration with mask (mask) (with source code) - Color Space's blog - CSDN blog

The corresponding implementation code of OpenCvSharp is given below (version--OpenCvSharp4.5.5.20211231):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using OpenCvSharp;

namespace MatchTemplate_WithMask
{
    class Program
    {
        static void Main(string[] args)
        {
            ///单模板匹配
            Mat img = Cv2.ImRead("A1.png");
            //Mat temp = new Mat(img, new Rect(420, 20, 90, 90)).Clone(); //A2.png
            Mat temp = new Mat(img, new Rect(550+130, 20, 90, 90)).Clone(); //A1.p

Guess you like

Origin blog.csdn.net/stq054188/article/details/123750169