Parameters: |
|
The function calculates the
matrix of an affine transform so that:
where
# -*- coding: utf-8 -*-标签:200,13,plt,img,OpenCV4.4,cv2,50,dst,仿射变换 From: https://blog.51cto.com/u_12504263/5718754
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('1.jpg')
rows,cols,ch = img.shape
pts1 = np.float32([[50,50],[200,50],[50,200]])
pts2 = np.float32([[10,100],[200,50],[100,250]])
M = cv2.getAffineTransform(pts1,pts2)
dst = cv2.warpAffine(img,M,(cols,rows))
plt.subplot(121),plt.imshow(img),plt.title('Input')
plt.subplot(122),plt.imshow(dst),plt.title('Output')
plt.show()