mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 09:48:20 +08:00
Opt: scan emotion status to adjust emotion value
This commit is contained in:
@@ -1039,6 +1039,23 @@ def color_similarity_2d(image, color):
|
||||
return positive
|
||||
|
||||
|
||||
def image_color_count(image, color, threshold=221, count=50):
|
||||
"""
|
||||
Args:
|
||||
image (np.ndarray):
|
||||
color (tuple): RGB.
|
||||
threshold: 255 means colors are the same, the lower the worse.
|
||||
count (int): Pixels count.
|
||||
|
||||
Returns:
|
||||
bool:
|
||||
"""
|
||||
mask = color_similarity_2d(image, color=color)
|
||||
cv2.inRange(mask, threshold, 255, dst=mask)
|
||||
sum_ = cv2.countNonZero(mask)
|
||||
return sum_ > count
|
||||
|
||||
|
||||
def extract_letters(image, letter=(255, 255, 255), threshold=128):
|
||||
"""Set letter color to black, set background color to white.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user