LAB4 / utils /image_processing.py
nnibras's picture
Upload 17 files
6aab31e verified
raw
history blame contribute delete
380 Bytes
import cv2
def resize_image(image, width=None, height=None):
if width is None and height is None:
return image
(h, w) = image.shape[:2]
if width is None:
ratio = height / float(h)
width = int(w * ratio)
else:
ratio = width / float(w)
height = int(h * ratio)
return cv2.resize(image, (width, height))