model_input.py 文件源码

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

项目:SLAM 作者: sanjeevkumar42 项目源码 文件源码
def read_rgb_image(filepath):
    rgb_img = ndimage.imread(filepath)
    width = height = 224
    img_width = rgb_img.shape[1]
    img_height = rgb_img.shape[0]

    # scale such that smaller dimension is 256
    if img_width < img_height:
        factor = 256.0 / img_width
    else:
        factor = 256.0 / img_height
    rgb_img = transform.rescale(rgb_img, factor, preserve_range=True)

    # crop randomly
    width_start = np.random.randint(0, rgb_img.shape[1] - width)
    height_start = np.random.randint(0, rgb_img.shape[0] - height)

    rgb_img = rgb_img[height_start:height_start + height, width_start:width_start + width]
    return rgb_img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号