0 like 0 dislike
1 view
in Python by anonymous Bilge (165k points)
python opencv resize image

cv cv2

1 Answer

0 like 0 dislike
by anonymous Bilge (165k points)
import cv2

img = cv2.imread('img/a1.jpg', cv2.IMREAD_UNCHANGED)

print('Original Dimensions : ', img.shape)

width = 64 # new
height = 48 # new
dim = (width, height)

# resize image
resized = cv2.resize(img, dim, interpolation=cv2.INTER_AREA)

print('Resized Dimensions : ', resized.shape)

cv2.imshow("Resized image", resized)
cv2.waitKey(0)
cv2.destroyAllWindows()
...