mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Merge branch 'master' of https://github.com/LmeSzinc/AzurLaneAutoScript
This commit is contained in:
commit
2c811a891b
@ -41,8 +41,9 @@ class SuffixOcr(Ocr):
|
||||
# will need to pad white background for better recognization
|
||||
image = image[8:-10, :]
|
||||
cv2.normalize(image, image, -55, 255, cv2.NORM_MINMAX)
|
||||
image = (image > 128).astype(np.uint8) * 255
|
||||
image = np.pad(image, ((4, 4), (0, 0)), mode='constant', constant_values=255)
|
||||
image = (image > 80).astype(np.uint8) * 255
|
||||
image = np.pad(image, ((0, 1), (0, 0)), mode='edge')
|
||||
image = np.pad(image, ((4, 3), (0, 0)), mode='constant', constant_values=255)
|
||||
return image
|
||||
|
||||
|
||||
|
||||
@ -52,13 +52,14 @@ def to_map_input_name(name: str) -> str:
|
||||
campaign_7_2 -> 7-2
|
||||
d3 -> D3
|
||||
"""
|
||||
name = str(name).upper()
|
||||
# Remove whitespaces
|
||||
name = re.sub('[ \t\n]', '', name).lower()
|
||||
# B-1 -> B1
|
||||
res = re.match(r'([a-zA-Z])+[- ]+(\d+)', name)
|
||||
if res:
|
||||
name = f'{res.group(1)}{res.group(2)}'
|
||||
# Change back to upper case for campaign removal
|
||||
name = str(name).upper()
|
||||
# campaign_7_2 -> 7-2
|
||||
name = name.replace('CAMPAIGN_', '').replace('_', '-')
|
||||
return name
|
||||
|
||||
Loading…
Reference in New Issue
Block a user