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

Opt: [ALAS] Reuse image array to improve memory performance

This commit is contained in:
LmeSzinc
2024-03-21 21:28:37 +08:00
parent 6a23f82e6c
commit 06cd62f3ee
4 changed files with 23 additions and 12 deletions

View File

@@ -165,11 +165,11 @@ class AScreenCap(Connection):
# ValueError: cannot reshape array of size 0 into shape (720,1280,4)
raise ImageTruncated(str(e))
image = cv2.flip(image, 0)
cv2.flip(image, 0, dst=image)
if image is None:
raise ImageTruncated('Empty image after cv2.flip')
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
cv2.cvtColor(image, cv2.COLOR_BGR2RGB, dst=image)
if image is None:
raise ImageTruncated('Empty image after cv2.cvtColor')