cv2 resize and transpose the image
Feb 24, 2021
It is interesting to know that when cv2 resize an image, the new image size with the shape of
(width, height) instead of (height, width)
>>> import cv2>>> img = cv2.imread("070720_bo_dogage_feat-1028x579.jpg", cv2.IMREAD_GRAYSCALE)>>> img.shape(579, 1028)>>> resized_img = cv2.resize(img, (512, 579))>>> resized_img.shape(579, 512)>>> t = cv2.transpose(resized_img)>>> t.shape(512, 579)