cv2.resize()和imutil.resize()

一、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)

cv2.resize()和imutil.resize()_第1张图片

 

二、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)

效果同上.

你可能感兴趣的:(pythonCV)