def project_image(self, image, size, offset=(0, 0)):
"""Remove parspective from given image.
Arguments:
image numpy.array -- Image source in numpy image form.
size ([int]) -- Size of the output image.
"""
translation = np.matrix([
[1.0, 0.0, -offset[0]],
[0.0, 1.0, -offset[1]],
[0.0, 0.0, 1.0]
])
matrix = translation * self.homography
return cv2.warpPerspective(image, matrix, tuple(size))
评论列表
文章目录