preprocessor.py 文件源码

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

项目:HandwritingRecognition 作者: eng-tsmith 项目源码 文件源码
def squeeze(image, width_max, border):
    """
    This function squeezes images in the width.
    :param image: Numpy array of image
    :param width_max: max image width
    :param border: border left and right of squeezed image
    :return: Squeezed Image
    """
    image_wd = image.shape[1]
    image_ht = image.shape[0]
    basewidth = width_max - border

    wpercent = basewidth / image_wd
    dim = (int(wpercent*image_wd), image_ht)
    img_squeeze = cv.resize(image, dim, interpolation=cv.INTER_NEAREST)
    return img_squeeze
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号