1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-09 18:39:04 +08:00

Fix: Ensure color_similarity_2d gets a numpy array

This commit is contained in:
LmeSzinc 2020-07-22 01:55:51 +08:00
parent a64dbb5837
commit 5bdaddc219

View File

@ -300,6 +300,7 @@ def color_similarity_2d(image, color):
Returns:
np.ndarray: uint8
"""
image = np.array(image)
r, g, b = cv2.split(cv2.subtract(image, (*color, 0)))
positive = cv2.max(cv2.max(r, g), b)
r, g, b = cv2.split(cv2.subtract((*color, 0), image))
@ -318,6 +319,7 @@ def extract_letters(image, letter=(255, 255, 255), threshold=128):
Returns:
np.ndarray: Shape (height, width)
"""
image = np.array(image)
r, g, b = cv2.split(cv2.subtract(image, (*letter, 0)))
positive = cv2.max(cv2.max(r, g), b)
r, g, b = cv2.split(cv2.subtract((*letter, 0), image))