Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def image_wrap(img, src, dst, img_size):
- """
- Perpesctive transfor of an image based on source and destination image points.
- :param img:
- Image to transform
- :param: src:
- Source coordinates
- :param dst:
- Destination coordinates
- :param img_size:
- Image shape
- :returns:
- Tuple of the warped image, the transform matrix and inverse transform matrix
- """
- M = cv2.getPerspectiveTransform(src, dst)
- Minv = cv2.getPerspectiveTransform(dst, src)
- warped = cv2.warpPerspective(img, M, img_size, flags=cv2.INTER_LINEAR)
- return warped, M, Minv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement