data_input.py 文件源码

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

项目:SomeoneSensor 作者: samfk6 项目源码 文件源码
def resize_with_pad(image, height=IMAGE_SIZE, width=IMAGE_SIZE):

    # def get_padding_size(image):
    #     h, w, _ = image.shape
    #     longest_edge = max(h, w)
    #     top, bottom, left, right = (0, 0, 0, 0)
    #     if h < longest_edge:
    #         dh = longest_edge - h
    #         top = dh // 2
    #         bottom = dh - top
    #     elif w < longest_edge:
    #         dw = longest_edge - w
    #         left = dw // 2
    #         right = dw - left
    #     else:
    #         pass
    #     return top, bottom, left, right

    # top, bottom, left, right = get_padding_size(image)
    # BLACK = [0, 0, 0]
    # constant = cv2.copyMakeBorder(image, top , bottom, left, right, cv2.BORDER_CONSTANT, value=BLACK)

    # resized_image = cv2.resize(constant, (height, width))
    resized_image = cv2.resize(image,(IMAGE_SIZE, IMAGE_SIZE))
    return resized_image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号