diff --git a/assets/share/rogue/entry/OCR_WORLD.png b/assets/share/rogue/entry/OCR_WORLD.png index 51bb5f5f7..3a8746284 100644 Binary files a/assets/share/rogue/entry/OCR_WORLD.png and b/assets/share/rogue/entry/OCR_WORLD.png differ diff --git a/tasks/rogue/assets/assets_rogue_entry.py b/tasks/rogue/assets/assets_rogue_entry.py index f67636b75..4b310a520 100644 --- a/tasks/rogue/assets/assets_rogue_entry.py +++ b/tasks/rogue/assets/assets_rogue_entry.py @@ -27,10 +27,10 @@ OCR_WORLD = ButtonWrapper( name='OCR_WORLD', share=Button( file='./assets/share/rogue/entry/OCR_WORLD.png', - area=(488, 339, 718, 371), - search=(468, 319, 738, 391), - color=(45, 44, 68), - button=(488, 339, 718, 371), + area=(488, 339, 718, 395), + search=(468, 319, 738, 415), + color=(38, 35, 64), + button=(488, 339, 718, 395), ), ) THEME_DLC = ButtonWrapper( diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index c3bc9b4a4..093c1618d 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -1,7 +1,11 @@ import re from datetime import datetime, timedelta +import cv2 +import numpy as np + from module.base.timer import Timer +from module.base.utils import color_similarity_2d from module.exception import RequestHumanTakeover, ScriptError from module.logger import logger from module.ocr.ocr import Ocr @@ -67,6 +71,16 @@ def chinese_to_arabic(chinese_number: str) -> int: class OcrRogueWorld(Ocr): + def pre_process(self, image): + # Letter randomly moving up and down + # Crop to the up/down border of the white letter + center = color_similarity_2d(image, color=(255, 255, 255)) + cv2.inRange(center, 180, 255, dst=center) + center = np.where(np.sum(center, axis=1) > 200)[0] + up, down = center[0], center[-1] + image = image[up:down, :, :] + return image + def format_result(self, result: str) -> int: res = re.search(r'第([一二三四五六七八九十])世界', result) if res: