1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-12 09:48:20 +08:00

Refactor: Use numpy image cache instead of pillow image

This commit is contained in:
LmeSzinc
2022-01-23 15:50:15 +08:00
parent 6df7684a37
commit 65f166ad12
51 changed files with 286 additions and 228 deletions

View File

@@ -184,7 +184,7 @@ class CampaignOcr(ModuleBase):
self.stage_entrance: dict. Key, str, stage name. Value, Button, button to enter stage.
Args:
image (PIL.Image.Image):
image (np.ndarray):
"""
self.stage_entrance = {}
buttons = self.campaign_extract_name_image(image)

View File

@@ -162,7 +162,7 @@ class GemsFarming(CampaignRun, Dock, EquipmentChange):
list_level = ocr.ocr(self.device.image)
for button, level in zip(card_grids.buttons, list_level):
if level == 1 and template.match(self.device.image.crop(button.area), similarity=SIM_VALUE):
if level == 1 and template.match(self.image_crop(button), similarity=SIM_VALUE):
return button
logger.info('No specific CV was found, try reversed order.')
@@ -171,7 +171,7 @@ class GemsFarming(CampaignRun, Dock, EquipmentChange):
list_level = ocr.ocr(self.device.image)
for button, level in zip(card_grids.buttons, list_level):
if level == 1 and template.match(self.device.image.crop(button.area), similarity=SIM_VALUE):
if level == 1 and template.match(self.image_crop(button), similarity=SIM_VALUE):
return button
return None