mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-10-12 21:52:11 +00:00
perf: reuse image array to improve memory performance
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import typing as t
|
||||
from dataclasses import dataclass
|
||||
from functools import wraps
|
||||
from json.decoder import JSONDecodeError
|
||||
@@ -10,8 +9,8 @@ from lxml import etree
|
||||
|
||||
from module.base.utils import *
|
||||
from module.device.connection import Connection
|
||||
from module.device.method.utils import (RETRY_TRIES, retry_sleep, handle_adb_error,
|
||||
ImageTruncated, PackageNotInstalled, possible_reasons)
|
||||
from module.device.method.utils import (ImageTruncated, PackageNotInstalled, RETRY_TRIES, handle_adb_error,
|
||||
possible_reasons, retry_sleep)
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
|
||||
@@ -122,7 +121,7 @@ class Uiautomator2(Connection):
|
||||
if image is None:
|
||||
raise ImageTruncated('Empty image after cv2.imdecode')
|
||||
|
||||
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
||||
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB, dst=image)
|
||||
if image is None:
|
||||
raise ImageTruncated('Empty image after cv2.cvtColor')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user