From 1bcef3071b150bf320d5ebd97c034b8d2d8a7a95 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Tue, 13 Feb 2024 01:22:35 +0800 Subject: [PATCH] Fix: IndexError in OcrRogueWorld --- tasks/rogue/entry/entry.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index 093c1618d..dfccf7637 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -77,6 +77,8 @@ class OcrRogueWorld(Ocr): 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] + if len(center) < 2: + return image up, down = center[0], center[-1] image = image[up:down, :, :] return image