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:
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