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

Merge pull request #85 from LmeSzinc/master

Fix: Ensure color_similarity_2d gets a numpy array
This commit is contained in:
Erik 2020-07-21 14:57:56 -03:00 committed by GitHub
commit 23c58e23f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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))