datapreptools.py 文件源码

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

项目:DmsMsgRcg 作者: bshao001 项目源码 文件源码
def resize_to_desired(input_img):
    h = input_img.shape[0]
    if h < 20:  # pad the image to 20 or 21 pixels height if it is too short
        border = math.ceil((20 - h) / 2)
        new_img = cv2.copyMakeBorder(input_img, top=border, bottom=border, left=0, right=0,
                                     borderType=cv2.BORDER_DEFAULT)
    else:
        new_img = input_img

    return cv2.resize(new_img, (CLS_IMG_WIDTH, CLS_IMG_HEIGHT))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号