2025-05-19 20:24:43 +08:00

66 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# <p align="center">图像界面识别-小组作业</p>
## 运行库
cv2、matplotlib、easyocr
## 实现原理
我们采用分割的方式将图片中所有玩家的ID和评分进行分割。<br>
然后我们对所有分割下来的图片进行识别,将文字提取出来。<br>
最终通过比较所有玩家的评分来找出评分最高的玩家。
## 分割
我们使用了最简单的方法进行分割。<br>
认为确认所有ID和评分的坐标位置进行分割。<br>
```c
# ID坐标
id = [
(460, 415, 800, 460),
(460, 610, 800, 655),
(550, 805, 800, 850),
(460, 995, 800, 1040),
(460, 1190, 800, 1235),
(1860, 415, 2200, 460),
(1930, 600, 2200, 665),
(1860, 805, 2200, 850),
(1930, 980, 2200, 1055),
(1860, 1190, 2200, 1235),
]
# 评分坐标
score = [
(335, 488, 465, 545),
(335, 680, 465, 740),
(335, 875, 465, 930),
(335, 1070, 465, 1125),
(335, 1260, 465, 1320),
(1710, 488, 1845, 545),
(1710, 680, 1845, 740),
(1710, 875, 1845, 930),
(1710, 1070, 1845, 1125),
(1710, 1260, 1845, 1320),
]
```
## 识别
采用[`easyocr`](https://github.com/JaidedAI/EasyOCR)来对图像进行识别。
```c
import easyocr
# 识别中文并关闭GPU完全使用CPU
reader = easyocr.Reader(['ch_sim'], gpu=False)
# 将RGB图像识别为文字
results_id.append(reader.readtext(rgb, detail=0))
```
## 比较
采用最简单的比较方式定义变量max_val = 0.0和max_idx = 0。<br>
循环对所有评分变量进行对比记下最大值何其对于的ID序号。
## 结果展示
### 图像分割结果
图像ID分割效果<br>
![id](/result/id.png#pic_center)
图像评分分割效果
![score](/result/score.png#pic_center)
## 致谢
感谢[`easyocr`](https://github.com/JaidedAI/EasyOCR)项目团队的每一个成员。
## 小组成员
张豪、孟梓涵、龚韩轩、张梦南<br>
(排名不分先后)