[python]Affine Transform

2023-11-3 写技术

import cv2
import numpy as np

img = cv2.imread("book.png",1)
img_org = img.copy()
h,w = img.shape[:2]
p1 = np.float32([[81,30],[378,80],[13,425]])
p2 = np.float32([[0,0],[300,0],[0,400]])
M = cv2.getAffineTransform(p1,p2)
img = cv2.warpAffine(img,M,(w, h))
cv2.imshow("org",img_org)
cv2.imshow("processed",img)
cv2.waitKey(0)

标签: linux python

发表评论:

Powered by anycle 湘ICP备15001973号-1