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))
cv.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录