mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Fix: Try without preprocess if no doors matched
This commit is contained in:
parent
acf72b18d5
commit
415fa61df9
@ -422,9 +422,12 @@ class Duration(Ocr):
|
||||
|
||||
|
||||
class OcrWhiteLetterOnComplexBackground(Ocr):
|
||||
white_preprocess = True
|
||||
|
||||
def pre_process(self, image):
|
||||
image = extract_white_letters(image, threshold=255)
|
||||
image = cv2.merge([image, image, image])
|
||||
if self.white_preprocess:
|
||||
image = extract_white_letters(image, threshold=255)
|
||||
image = cv2.merge([image, image, image])
|
||||
return image
|
||||
|
||||
def detect_and_ocr(self, *args, **kwargs):
|
||||
|
@ -235,6 +235,10 @@ class RogueExit(CombatInteract):
|
||||
|
||||
ocr = OcrDomainExit(OCR_DOMAIN_EXIT)
|
||||
results = ocr.matched_ocr(image, keyword_classes=MapPlane)
|
||||
# Try without preprocess
|
||||
if not len(results):
|
||||
ocr.white_preprocess = False
|
||||
results = ocr.matched_ocr(image, keyword_classes=MapPlane)
|
||||
centers = [area_center(result.area) for result in results]
|
||||
logger.info(f'DomainDoor: {centers}')
|
||||
directions = [self.screen2direction(center) for center in centers]
|
||||
|
Loading…
Reference in New Issue
Block a user