@@ -460,11 +460,8 @@ class PrintPainting:
|
|||||||
angle: 旋转的角度
|
angle: 旋转的角度
|
||||||
crop: 是否需要进行裁剪,布尔向量
|
crop: 是否需要进行裁剪,布尔向量
|
||||||
"""
|
"""
|
||||||
if not isinstance(crop, bool):
|
|
||||||
raise ValueError("The 'crop' parameter must be a boolean.")
|
|
||||||
|
|
||||||
crop_image = lambda img, x0, y0, w, h: img[y0:y0 + h, x0:x0 + w]
|
crop_image = lambda img, x0, y0, w, h: img[y0:y0 + h, x0:x0 + w]
|
||||||
h, w = img.shape[:2]
|
w, h = img.shape[:2]
|
||||||
# 旋转角度的周期是360°
|
# 旋转角度的周期是360°
|
||||||
angle %= 360
|
angle %= 360
|
||||||
# 计算仿射变换矩阵
|
# 计算仿射变换矩阵
|
||||||
@@ -476,7 +473,7 @@ class PrintPainting:
|
|||||||
if crop:
|
if crop:
|
||||||
# 裁剪角度的等效周期是180°
|
# 裁剪角度的等效周期是180°
|
||||||
angle_crop = angle % 180
|
angle_crop = angle % 180
|
||||||
if angle_crop > 90:
|
if angle > 90:
|
||||||
angle_crop = 180 - angle_crop
|
angle_crop = 180 - angle_crop
|
||||||
# 转化角度为弧度
|
# 转化角度为弧度
|
||||||
theta = angle_crop * np.pi / 180
|
theta = angle_crop * np.pi / 180
|
||||||
|
|||||||
Reference in New Issue
Block a user