1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-12 16:47:03 +08:00

Upd: resize and change similarity for 1920x1080 images in campaign

bonus
This commit is contained in:
sui-feng-cb
2025-12-03 13:46:26 +08:00
parent 49085b3e35
commit fa44b728bc
3 changed files with 35 additions and 9 deletions

View File

@@ -68,7 +68,29 @@ def unpack(image):
size = image_size(image)
if size == (1280, 720):
return [image]
elif size[0] / 1280 == size[1] / 720:
return [cv2.resize(image, (1280, 720), interpolation=cv2.INTER_LANCZOS4)]
else:
if size[0] != 1280 or size[1] % 720 != 0:
raise ImageInvalidResolution(f'Unexpected image size: {size}')
return [crop(image, (0, n * 720, 1280, (n + 1) * 720)) for n in range(size[1] // 720)]
def get_similarity(image):
"""
Get similarity to.
Args:
image:
Returns:
float: 0-1. Similarity.
"""
size = image_size(image)
if size == (1280, 720):
return 0.85
elif size[0] / 1280 == size[1] / 720:
return 0.7
else:
if size[0] != 1280 or size[1] % 720 != 0:
raise ImageInvalidResolution(f'Unexpected image size: {size}')
return 0.85