opencv python chapter2 图像展开
import cv2 as cv
import numpy as np
img = cv.imread(r"image/pk.jpeg")
width,height = (250,350)
pts1 = np.float32([[670,45],[985,190],[460,500],[770,635]])
pts2 = np.float32([[0,0],[width,0],[0,height],[width,height]])
matrix = cv.getPerspectiveTransform(pts1,pts2)
imgOutput = cv.warpPerspective(img,matrix,(width,height))
cv.imshow("imgOutput",imgOutput)
cv.imshow("image",img)
cv.waitKey(0)
浙公网安备 33010602011771号