1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-29 09:17:13 +08:00

Opt: Remove redundant converts from pillow to numpy

This commit is contained in:
LmeSzinc
2022-01-24 23:43:53 +08:00
parent c5ed59ab26
commit e92579b5f9
28 changed files with 62 additions and 64 deletions

View File

@@ -95,7 +95,7 @@ def get_research_name(image):
def get_research_finished(image):
"""
Args:
image: Pillow image
image (np.ndarray):
Returns:
int: Index of the finished project, 0 to 4. Return None if no project finished.
@@ -150,7 +150,6 @@ def match_template(image, template, area, offset=30, threshold=0.85):
else:
offset = np.array((0, -offset, 0, offset))
image = crop(image, offset + area)
template = np.array(template)
res = cv2.matchTemplate(image, template, cv2.TM_CCOEFF_NORMED)
_, sim, _, point = cv2.minMaxLoc(res)
similarity = sim if sim >= threshold else 0.0

View File

@@ -154,7 +154,7 @@ class RewardResearch(ResearchSelector):
else:
self.device.screenshot()
max_rgb = np.max(rgb2gray(np.array(self.image_crop(RESEARCH_UNAVAILABLE))))
max_rgb = np.max(rgb2gray(self.image_crop(RESEARCH_UNAVAILABLE)))
# Don't use interval here, RESEARCH_CHECK already appeared 5 seconds ago
if click_timer.reached() and self.appear(RESEARCH_CHECK, offset=(20, 20)):