1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-24 19:29:05 +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

@@ -175,7 +175,7 @@ class GlobeCamera(GlobeOperation, ZoneManager):
screen = self.globe2screen(location).flatten().round()
screen = np.round(screen).astype(int).tolist()
# Average color of whirlpool center
center = np.array(self.image_crop(screen))
center = self.image_crop(screen)
center = np.array([[cv2.mean(center), ], ]).astype(np.uint8)
h, s, v = rgb2hsv(center)[0][0]
# hsv usually to be (338, 74.9, 100)

View File

@@ -107,12 +107,11 @@ class GlobeDetection:
def load(self, image):
"""
Args:
image: Pillow image.
image (np.ndarray):
"""
self.load_globe_map()
start_time = time.time()
image = np.array(image)
local = self.find_peaks(self.perspective_transform(image), para=self.config.OS_LOCAL_FIND_PEAKS_PARAMETERS)
local = local.astype(np.uint8)
local = cv2.resize(local, None, fx=self.config.OS_GLOBE_IMAGE_RESIZE, fy=self.config.OS_GLOBE_IMAGE_RESIZE)