mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 07:28:21 +08:00
Dev: Item statistics rework
This commit is contained in:
21
module/statistics/battle_status.py
Normal file
21
module/statistics/battle_status.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
Reference in New Issue
Block a user