a03_augmentation.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:KAGGLE_CERVICAL_CANCER_2017 作者: ZFTurbo 项目源码 文件源码
def random_rotate(image):
    cols = image.shape[1]
    rows = image.shape[0]
    mean_color = np.mean(image, axis=(0, 1))

    angle = random.uniform(0, 90)
    M = cv2.getRotationMatrix2D((cols / 2, rows / 2), angle, 1)
    if random.randint(0, 1) == 1:
        dst = cv2.warpAffine(image, M, (cols, rows), borderValue=mean_color, borderMode=cv2.BORDER_REFLECT)
    else:
        dst = cv2.warpAffine(image, M, (cols, rows), borderValue=mean_color)
    return dst
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号