修复类型注解

This commit is contained in:
2025-10-02 12:06:20 +08:00
parent 8c4fa2b5e4
commit 9fb8fd90dc

View File

@ -332,9 +332,10 @@ async def generate_dice_image(number: str) -> BytesIO:
up_direction = (51 - 16, 5 - 30) # 右上角点 - 左上角点
move_distance = (up_direction[0] * (stretch_k - 1), up_direction[1] * (stretch_k - 1))
# 加载背景图像,保留透明通道
background = cv2.imread(ASSETS_PATH / "img" / "dice" / "template.png", cv2.IMREAD_UNCHANGED)
background = cv2.imread(str(ASSETS_PATH / "img" / "dice" / "template.png"), cv2.IMREAD_UNCHANGED)
assert background is not None
height, width = background.shape[:2]
@ -352,7 +353,7 @@ async def generate_dice_image(number: str) -> BytesIO:
], dtype=np.float32)
corners[:, 0] += offset_x
corners[:, 1] += offset_y
# 对文本图像进行3D变换保持透明通道
transformed_text, transform_matrix = perspective_transform(text_image, background, corners)