preprocessor.py 文件源码

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

项目:HandwritingRecognition 作者: eng-tsmith 项目源码 文件源码
def random_noise(img):  #TODO dataug
    """
    Puts random noise on image
    :param img: image without noise
    :return: image with noise
    """
    severity = np.random.uniform(0, 0.6)
    blur = ndimage.gaussian_filter(np.random.randn(*img.shape) * severity, 1)
    img_speck = (img + blur)
    img_speck[img_speck > 1] = 1
    img_speck[img_speck <= 0] = 0

    return img_speck
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号