OpenCV 将图像通过透视变换矫正
作者:互联网
案例:Fu Xianjun. All Rights Reserved.
import cv2
import numpy as np
img = cv2,imread('lianxi.png')
h,w,a = img.shape
pts1 = np.float32([[50,180],[220,80],[60,290],[270,190]])
pts2 = np.float([[0,0],[210,0],[0,150],[210,150]])
M = cv2.getPerspectiveTransform(pts1,pts2)
dst = cv2.warpPerspective(img,M,(w,h))
cv2.imshow("img",img)
cv2.imshow("dst",dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
标签:矫正,150,img,透视,dst,imshow,cv2,OpenCV,np 来源: https://blog.csdn.net/weixin_57511504/article/details/118280227