utils.py 文件源码

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

项目:faststyle 作者: ghwatson 项目源码 文件源码
def imresize(img, scale):
    """Depending on if we scale the image up or down, we use an interpolation
    technique as per OpenCV recommendation.

    :param img:
        3D numpy array of image.
    :param scale:
        float to scale image by in both axes.
    """
    if scale > 1.0:  # use cubic interpolation for upscale.
        img = cv2.resize(img, None, interpolation=cv2.INTER_CUBIC,
                         fx=scale, fy=scale)
    elif scale < 1.0:  # area relation sampling for downscale.
        img = cv2.resize(img, None, interpolation=cv2.INTER_AREA,
                         fx=scale, fy=scale)
    return img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号