import cv2
import numpy as np
people = cv2.imread('1.png')
new = cv2.resize(people,None,fx=3.0,fy=3.0,interpolation=cv2.INTER_AREA)
cv2.imshow('people',people)
cv2.imshow('new',new)
cv2.waitKey(0)
import cv2
import numpy as np
people = cv2.imread('1.png')
new = cv2.flip(people,-1)
cv2.imshow('people',people)
cv2.imshow('new',new)
cv2.waitKey(0)
import cv2
import numpy as np
people = cv2.imread('1.png')
new = cv2.rotate(people,cv2.ROTATE_90_CLOCKWISE)
cv2.imshow('people',people)
cv2.imshow('new',new)
cv2.waitKey(0)
import cv2
import numpy as np
people = cv2.imread('1.png')
h,w,ch = people.shape
M = np.float32([[1,0,50],[0,1,0]])
new = cv2.warpAffine(people,M,(w,h))
cv2.imshow('people',people)
cv2.imshow('new',new)
cv2.waitKey(0)
M = cv2.getRotationMatrix2D((w/2,h/2),30,1.5)
src = np.float32([[400,300],[800,300],[400,1000]])
dst = np.float32([[200,400],[600,500],[150,1100]])
M = cv2.getAffineTransform(src,dst)
变换坐标系(可以将斜着的图片截取一部分并且变成正着)
warpPerspective(img,M,dsize,…)
获取变换矩阵:getPerspectiveTransform(src,dst)
M = cv2.getPerspectiveTransform(src,dst)
new = cv2.warpPerspective(img,M,(2300,3000))