Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy as np
- import matplotlib.pyplot as plt
- img = cv2.imread('IMG_20180522_211242_2.jpg')
- pts1 = np.float32([[58,642],[147,627],[83,733],[168,716],[2320,2654],[2291,2566],[2238,2675],[2211,2588]])
- pts2 = np.float32([[50,50],[150,50],[50,150],[150,150],[2100-50, 2970-50],[2100-50,2970-150],[2100-150,2970-50],[2100-150,2970-150]])
- size = (2100,2970)
- M, mask = cv2.findHomography(pts1,pts2)
- dst = cv2.warpPerspective(img,M,size)
- plt.subplot(121),plt.imshow(img),plt.title('Input')
- plt.subplot(122),plt.imshow(dst),plt.title('Output')
- plt.show()
Add Comment
Please, Sign In to add comment