cv.py 文件源码

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

项目:Physical-Image-Manipulation-Program 作者: philipptrenz 项目源码 文件源码
def scale_to_fit(img, size):
    """
    Scales an image to a given size by warping with no regard to the ratio.
    Returns: warped image as ndarray
    """

    width = len(img[0])
    height = len(img)

    src = numpy.array((
        (0, 0),
        (0, size[1]),
        (size[0], size[1]),
        (size[0], 0)
    ))


    dst = numpy.array((
        (0, 0),
        (0, height),
        (width, height),
        (width, 0)
    ))

    tform = transform.ProjectiveTransform()
    tform.estimate(src, dst)

    return transform.warp(img, tform, output_shape=(size[1],size[0]))





#########################################################################################################
#########################################################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号