lip_image.py 文件源码

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

项目:lipnet 作者: grishasergei 项目源码 文件源码
def _remove_padding(path_to_image, output_path, padding):
    """
    Removes padding of a single image and saves output to a new file
    :param path_to_image: full path to an input image
    :param output_path: full path to a file in which output result is saved
    :param padding: integer
    :return: nothing
    """
    if not os.path.isfile(path_to_image):
        print 'Warning: %s not found' % path_to_image
        return
    # read image
    image = io.imread(path_to_image)
    dim = image.shape
    x = dim[0] - padding
    y = dim[1] - padding
    # crop the image
    image_cropped = image[padding:x, padding:y]
    # save cropped image
    io.imsave(output_path, image_cropped)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号