1 | initial version |
easy !
ifyou look at resize():
>>> help(cv2.resize)
>>> resize(...)
resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) -> dst
you see, there's an fx and fy parameter. use those instead of the fixed dsize argument, to preserve your original ratio:
# half size:
resized = cv2.resize(image, fx=0.5, fy=0.5, interpolation = cv2.INTER_LINEAR)