Skip to content

Commit

Permalink
特征匹配
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoZuohong committed Jul 13, 2024
1 parent c7b1fd2 commit 7619b8c
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 4 deletions.
1 change: 0 additions & 1 deletion _includes/cropimg.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">matplotlib</span> <span class="kn">import</span> <span class="n">pyplot</span> <span class="k">as</span> <span class="n">plt</span>

<span class="kn">from</span> <span class="nn">arknights_mower.utils.image</span> <span class="kn">import</span> <span class="n">cropimg</span><span class="p">,</span> <span class="n">loadimg</span>
</pre></div>
</div>
Expand Down
286 changes: 286 additions & 0 deletions _includes/feature-matching.html

Large diffs are not rendered by default.

138 changes: 138 additions & 0 deletions _includes/feature-point.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion _includes/loadimg.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">matplotlib</span> <span class="kn">import</span> <span class="n">pyplot</span> <span class="k">as</span> <span class="n">plt</span>

<span class="kn">from</span> <span class="nn">arknights_mower.utils.image</span> <span class="kn">import</span> <span class="n">loadimg</span><span class="p">,</span> <span class="n">loadres</span>
</pre></div>
</div>
Expand Down
1 change: 0 additions & 1 deletion _includes/thres2.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<div class="inner_cell">
<div class="input_area">
<div class="highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">matplotlib</span> <span class="kn">import</span> <span class="n">pyplot</span> <span class="k">as</span> <span class="n">plt</span>

<span class="kn">from</span> <span class="nn">arknights_mower.utils.image</span> <span class="kn">import</span> <span class="n">loadimg</span><span class="p">,</span> <span class="n">thres2</span>
</pre></div>
</div>
Expand Down
1 change: 1 addition & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ sort: 6
2. [版本与分支](./branch)
3. [文档](./doc)
4. [图像处理基础函数](./image)
5. [特征匹配](./feature-matching)
2 changes: 1 addition & 1 deletion dev/branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Mower 使用 GitHub Actions 自动为 Windows 平台打包。打包过程中,
当提交信息是“发版”时,CI 不会修改版本号;反之,CI 会把 commit id 的前 7 位附加到版本号后面,使用加号分隔。
- 测试版使用滚动更新,版本号格式为 `YYYY.MM+<commit id>`,其中 `YYYY` 为四位年份,`MM` 为两位月份,`<commit id>` 为 commit id 的前 7 位。测试版代码的 `__version__` 中只写 `YYYY.MM` 的部分,由 CI 自动添加 commit id。
- 测试版使用滚动更新,版本号格式为 `YYYY.MM+<commit id>`,其中 `YYYY` 为四位年份,`MM` 为两位月份,`<commit id>` 为 commit id 的前 7 位。测试版代码的 `__version__` 中只写 `YYYY.MM` 的部分。如果从源码运行 mower,在启动时利用 `arknights_mower/utils/git_rev` 获得 commit id;在打包时,由 CI 自动添加 commit id。
- 稳定版使用定点更新,版本号格式为 `YYYY.MM.X`,其中 `X` 为小版本号。创建分支时 `X` 为 1,以后每次发版时,需手动增加 `X`,并将提交信息设为“发版”。

## 日志页背景
Expand Down
27 changes: 27 additions & 0 deletions dev/feature-matching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
sort: 5
---

# 特征匹配

特征匹配是 mower 中最方便的识别方法。在截图中匹配目标图像时,首先提取截图与目标图像的特征点,然后找出匹配的特征点对,利用匹配结果在截图中定位目标图像。

## 特征与特征点

可以直接使用 `arknights_mower.utils.matcher` 中的 `ORB` 提取特征点。

一般而言,在图像中,拐角、复杂的图案与纹理(包括文字)处可以提取到较多的特征点;在空白处,很难或无法提取到特征点。从复杂的图像中可以提取到更多的特征点。

<details>
<summary>使用示例</summary>
{% include feature-point.html %}
</details>

## 特征点的匹配

可以直接使用 `arknights_mower.utils.matcher` 中的 `flann` 对特征点进行匹配。

<details>
<summary>使用示例</summary>
{% include feature-matching.html %}
</details>

0 comments on commit 7619b8c

Please sign in to comment.