cv.py 文件源码

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

项目:Physical-Image-Manipulation-Program 作者: philipptrenz 项目源码 文件源码
def warp(img, corners):
    """
    Warpes an image by keeping its size, transforming the pixel data to 
    be distorted between the four corners.
    """

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

    src = numpy.array((
        corners['upper_left'],
        corners['lower_left'],
        corners['lower_right'],
        corners['upper_right']
    ))

    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=(height,width))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号