图片缩放(仿射实现)

import cv2
import numpy as np

img = cv2.imread('image0.jpg', 1)
cv2.imshow('src', img)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
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)

  

 

 

posted @ 2019-07-19 21:07  青衫客36  阅读(211)  评论(0编辑  收藏  举报