图片的几何变换《05图片缩放》

图片的几何变换《05图片缩放》

代码

import cv2
import numpy as np

img = cv2.imread('1.jpg',1)
cv2.imshow('source',img)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
# matScale缩放矩阵
matScale = np.float32([[0.5,0,0],[0,0.5,0]])
dst = cv2.warpAffine(img, matScale,(int(width/2),int(height/2)))
cv2.imshow('dst',dst)
cv2.waitKey(0)
发布了83 篇原创文章 · 获赞 25 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/Jamesaonier/article/details/105126817