Created
October 28, 2021 06:40
-
-
Save Nithilaa/8ab79b4bce19ccb5eb14effeac750601 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
img = cv2.imread('perspective transformation.jpg', 1) | |
cv2.imshow("Perspective Transformation Image", img) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() | |
rows, cols, ch = img.shape | |
pt1 = np.float32([[219,209],[612,8],[380,493],[785,271]]) | |
pt2 = np.float32([[0,0],[500,0],[0,400],[500,400]]) | |
matrix_aff = cv2.getPerspectiveTransform(pt1,pt2) | |
dst = cv2.warpPerspective(img,matrix_aff,(cols,rows)) | |
cv2.imshow("Perspective Transformation", dst) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment