img = cv2.imread("lena.jpg", -1)
height, width = img.shape[:2]
# 缩小图像
size = (int(width*0.5), int(height*0.5))
shrink = cv2.resize(img, size, interpolation=cv2.INTER_AREA)
# 放大图像
fx = 1280
fy = 1280
enlarge = cv2.resize(img, (0, 0), fx=fx, fy=fy, interpolation=cv2.INTER_CUBIC)
# 显示
cv2.imshow("src", img)
cv2.imshow("shrink", shrink)
cv2.imshow("enlarge", enlarge)