Cv2.resize()およびimutil.resize()



Cv2 Resize Imutil



まず、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)

効果は上記と同じです。