1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-16 10:27:21 +08:00

Pref: Reuse image array to improve memory performance

This commit is contained in:
LmeSzinc
2024-06-05 00:20:31 +08:00
parent 77d48937fc
commit 58202c6a40
34 changed files with 61 additions and 58 deletions

View File

@@ -116,7 +116,7 @@ class RadarGrid:
Returns:
bool:
"""
image = crop(self.image, area_offset(area, self.center))
image = crop(self.image, area_offset(area, self.center), copy=False)
mask = color_similarity_2d(image, color=color) > threshold
return np.sum(mask) >= count
@@ -236,7 +236,7 @@ class Radar:
Or None if port not found.
"""
radius = (15, 82)
image = crop(image, area_offset((-radius[1], -radius[1], radius[1], radius[1]), self.center))
image = crop(image, area_offset((-radius[1], -radius[1], radius[1], radius[1]), self.center), copy=False)
# image.show()
points = np.where(color_similarity_2d(image, color=(255, 255, 255)) > 250)
points = np.array(points).T[:, ::-1] - (radius[1], radius[1])