Skip to content

Commit 0621d6d

Browse files
authored
Add files via upload
1 parent 78f755a commit 0621d6d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

blog36-jhbh/blog36-09-fs.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#encoding:utf-8
2+
#By:Eastmount CSDN 2021-02-01
3+
import cv2
4+
import numpy as np
5+
import matplotlib.pyplot as plt
6+
7+
#读取图片
8+
src = cv2.imread('test.bmp')
9+
10+
#获取图像大小
11+
rows, cols = src.shape[:2]
12+
13+
#设置图像仿射变换矩阵
14+
pos1 = np.float32([[50,50], [200,50], [50,200]])
15+
pos2 = np.float32([[10,100], [200,50], [100,250]])
16+
M = cv2.getAffineTransform(pos1, pos2)
17+
18+
#图像仿射变换
19+
result = cv2.warpAffine(src, M, (cols, rows))
20+
21+
#显示图像
22+
cv2.imshow("original", src)
23+
cv2.imshow("result", result)
24+
25+
#等待显示
26+
cv2.waitKey(0)
27+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)