mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-19 23:33:33 +08:00
Fix: Ocr.buttons should be lazy loaded (#2278)
This commit is contained in:
@@ -33,8 +33,7 @@ class Ocr:
|
|||||||
name (str):
|
name (str):
|
||||||
"""
|
"""
|
||||||
self.name = str(buttons) if isinstance(buttons, Button) else name
|
self.name = str(buttons) if isinstance(buttons, Button) else name
|
||||||
self.buttons = buttons if isinstance(buttons, list) else [buttons]
|
self._buttons = buttons
|
||||||
self.buttons = [button.area if isinstance(button, Button) else button for button in self.buttons]
|
|
||||||
self.letter = letter
|
self.letter = letter
|
||||||
self.threshold = threshold
|
self.threshold = threshold
|
||||||
self.alphabet = alphabet
|
self.alphabet = alphabet
|
||||||
@@ -44,6 +43,13 @@ class Ocr:
|
|||||||
def cnocr(self) -> "AlOcr":
|
def cnocr(self) -> "AlOcr":
|
||||||
return OCR_MODEL.__getattribute__(self.lang)
|
return OCR_MODEL.__getattribute__(self.lang)
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def buttons(self):
|
||||||
|
buttons = self._buttons
|
||||||
|
buttons = buttons if isinstance(buttons, list) else [buttons]
|
||||||
|
buttons = [button.area if isinstance(button, Button) else button for button in buttons]
|
||||||
|
return buttons
|
||||||
|
|
||||||
def pre_process(self, image):
|
def pre_process(self, image):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
Reference in New Issue
Block a user