mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-17 07:35:25 +08:00
Pref: Reuse image array to improve memory performance
This commit is contained in:
@@ -115,7 +115,7 @@ class CampaignOcr(ModuleBase):
|
||||
|
||||
@cached_property
|
||||
def _stage_image(self):
|
||||
return crop(self.device.image, self._stage_detect_area)
|
||||
return crop(self.device.image, self._stage_detect_area, copy=False)
|
||||
|
||||
@cached_property
|
||||
def _stage_image_gray(self):
|
||||
@@ -270,6 +270,8 @@ class CampaignOcr(ModuleBase):
|
||||
del_cached_property(self, '_stage_image')
|
||||
del_cached_property(self, '_stage_image_gray')
|
||||
buttons = self.campaign_extract_name_image(image)
|
||||
del_cached_property(self, '_stage_image')
|
||||
del_cached_property(self, '_stage_image_gray')
|
||||
if len(buttons) == 0:
|
||||
logger.info('No stage found.')
|
||||
raise CampaignNameError
|
||||
|
||||
@@ -217,7 +217,7 @@ class GemsFarming(CampaignRun, FleetEquipment, Dock):
|
||||
|
||||
scanner.set_limitation(fleet=0)
|
||||
candidates = [ship for ship in scanner.scan(self.device.image, output=False)
|
||||
if template.match(self.image_crop(ship.button), similarity=SIM_VALUE)]
|
||||
if template.match(self.image_crop(ship.button, copy=False), similarity=SIM_VALUE)]
|
||||
|
||||
if candidates:
|
||||
return candidates
|
||||
@@ -226,7 +226,7 @@ class GemsFarming(CampaignRun, FleetEquipment, Dock):
|
||||
self.dock_sort_method_dsc_set(False)
|
||||
|
||||
candidates = [ship for ship in scanner.scan(self.device.image)
|
||||
if template.match(self.image_crop(ship.button), similarity=SIM_VALUE)]
|
||||
if template.match(self.image_crop(ship.button, copy=False), similarity=SIM_VALUE)]
|
||||
|
||||
return candidates
|
||||
|
||||
@@ -279,7 +279,7 @@ class GemsFarming(CampaignRun, FleetEquipment, Dock):
|
||||
candidates = []
|
||||
for item in template:
|
||||
candidates = [ship for ship in scanner.scan(self.device.image, output=False)
|
||||
if item.match(self.image_crop(ship.button), similarity=SIM_VALUE)]
|
||||
if item.match(self.image_crop(ship.button, copy=False), similarity=SIM_VALUE)]
|
||||
if candidates:
|
||||
break
|
||||
return candidates
|
||||
|
||||
Reference in New Issue
Block a user