From ad4993c3cfe8532082168e7313c0e2f75d7100f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E4=BA=91?= Date: Mon, 13 Jan 2025 08:38:10 +0800 Subject: [PATCH] Add some comments --- .../OpenCv/FeatureMatch/FeatureMatcher.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/BetterGenshinImpact/Core/Recognition/OpenCv/FeatureMatch/FeatureMatcher.cs b/BetterGenshinImpact/Core/Recognition/OpenCv/FeatureMatch/FeatureMatcher.cs index b4c2982d..446ad10f 100644 --- a/BetterGenshinImpact/Core/Recognition/OpenCv/FeatureMatch/FeatureMatcher.cs +++ b/BetterGenshinImpact/Core/Recognition/OpenCv/FeatureMatch/FeatureMatcher.cs @@ -7,7 +7,6 @@ using OpenCvSharp.XFeatures2D; using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Linq; namespace BetterGenshinImpact.Core.Recognition.OpenCv.FeatureMatch; @@ -137,10 +136,10 @@ public class FeatureMatcher /// /// 合并邻近的特征点后匹配(临近特征) /// - /// 查询的图 + /// 查询图像的 Mat 对象。 /// 上次匹配到的坐标x /// 上次匹配到的坐标y - /// 查询Mask + /// 查询图像的 Mask,用于限定检测特征的区域。 /// public Point2f Match(Mat queryMat, float prevX, float prevY, Mat? queryMatMask = null) { @@ -151,18 +150,17 @@ public class FeatureMatcher Debug.WriteLine($"---------切换到新的特征块({cellRow},{cellCol}),合并特征点--------"); _lastMergedBlock = KeyPointFeatureBlockHelper.MergeNeighboringFeatures(_blocks, _trainDescriptors, cellRow, cellCol); } - return Match(_lastMergedBlock.KeyPointArray, _lastMergedBlock.Descriptor!, queryMat, queryMatMask); } /// - /// 普通匹配 + /// 用于从训练图像和查询图像中找到匹配的特征点,计算透视变换并确定查询图像的中心点在训练图像中的位置。 /// - /// - /// - /// - /// - /// + /// 训练图像中的关键点集合。 + /// 训练图像的特征描述子。 + /// 查询图像的 Mat 对象。 + /// 查询图像的 Mask,用于限定检测特征的区域。 + /// 描述符匹配器的类型,默认为 DescriptorMatcherType.FlannBased /// public Point2f Match(KeyPoint[] trainKeyPoints, Mat trainDescriptors, Mat queryMat, Mat? queryMatMask = null, DescriptorMatcherType matcherType = DescriptorMatcherType.FlannBased)