def randomRotate(img, u=0.25, limit=90):
if random.random() < u:
angle = random.uniform(-limit, limit) # degree
height, width = img.shape[0:2]
mat = cv2.getRotationMatrix2D((width / 2, height / 2), angle, 1.0)
img = cv2.warpAffine(img, mat, (height, width), flags=cv2.INTER_LINEAR, borderMode=cv2.BORDER_REFLECT_101)
# img = cv2.warpAffine(img, mat, (height,width),flags=cv2.INTER_LINEAR,borderMode=cv2.BORDER_CONSTANT)
return img
n06_pytorch_utils.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录