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()


 

OpenCV 将图像通过透视变换矫正

OpenCV 将图像通过透视变换矫正

上一篇:cv.Laplacian()


下一篇:Python_10分钟学会图像平滑操作_专栏No.7