caffe_image.py 文件源码

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

项目:sail 作者: GemHunt 项目源码 文件源码
def get_whole_rotated_image(crop, mask, angle, crop_size, before_rotate_size, scale):
    #Better for larger:
    #pixels_to_jitter = 35 * scale
    #For Dates:
    pixels_to_jitter = 4 #Old Way

    center_x = before_rotate_size / 2 + (random.random() * pixels_to_jitter * 2) - pixels_to_jitter
    center_y = before_rotate_size / 2 + (random.random() * pixels_to_jitter * 2) - pixels_to_jitter

    rot_image = crop.copy()
    rot_image = rotate(rot_image, angle, center_x, center_y, before_rotate_size, before_rotate_size)
    # This is hard coded for 28x28.
    rot_image = cv2.resize(rot_image, (41, 41), interpolation=cv2.INTER_AREA)
    rot_image = rot_image[6:34, 6:34]

    # rot_image = rot_image * mask
    return rot_image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号