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

Fix: image_left_strip() returns an empty image because cropping outside

This commit is contained in:
LmeSzinc
2022-07-13 00:51:20 +08:00
parent 0fc155b87d
commit bc88e56897

View File

@@ -672,8 +672,12 @@ def image_left_strip(image, threshold, length):
"""
brightness = np.mean(image, axis=0)
match = np.where(brightness < threshold)[0]
if len(match):
image = image[:, match[0] + length:]
left = match[0] + length
total = image.shape[1]
if left < total:
image = image[:, left:]
return image