一、cv2.resize()
import cv2 img = cv2.imread("image1.png") print(img.shape) dst =
cv2.resize(img,(img.shape[1]//2,img.shape[0]//2),interpolation=cv2.INTER_CUBIC)
print(dst.shape) cv2.imshow("dst",dst) cv2.imshow("original",img) cv2.waitKey(0)
二、imutil.resize()
import cv2 import imutils img = cv2.imread("image1.png") print(img.shape) dst
= imutils.resize(img,width=img.shape[1]//2,height=img.shape[0]//2)
print(dst.shape) cv2.imshow("dst",dst) cv2.imshow("original",img) cv2.waitKey(0)
效果同上.
今日推荐