whoamikyo 09d3f695de Revert "Revert "Merge branch 'dev' of https://github.com/LmeSzinc/AzurLaneAutoScript into dev""
This reverts commit ac9303012c57bf648aa47d10db5738d0238ae76a.
2020-08-18 20:48:14 -03:00

22 lines
550 B
Python

from module.ocr.ocr import Ocr
from module.statistics.assets import ENEMY_NAME
ENEMY_NAME_OCR = Ocr(ENEMY_NAME, lang='cnocr', threshold=128)
class BattleStatusStatistics:
def stats_battle_status(self, image):
"""
Args:
image: Pillow image.
Returns:
str: Enemy name, such as '中型主力舰队'.
"""
result = ENEMY_NAME_OCR.ocr(image)
# Delete wrong OCR result
for letter in '-一个―~(':
result = result.replace(letter, '')
return result