def rotate_2d(img, angle_in_degrees,random_mode=True, probability=0.5):
if random_mode:
if random.random() < probability:
return img
rot_mat = cv.getRotationMatrix2D(tuple(np.array(img.shape)/2), angle, 1.0)
return apply_affine(img, rot_mat)
评论列表
文章目录