Resize an image without distortion OpenCV

前端 未结 9 1950
日久生厌
日久生厌 2020-12-07 12:30

I am using python 3 and latest version of openCV. I am trying to resize an image using the resize function provided but after resizing the image is very distorted. Code :

9条回答
  •  时光取名叫无心
    2020-12-07 13:14

    If you need to modify the image resolution and keep your aspect ratio use the function imutils (check documentation). something like this:

    img = cv2.imread(file , 0)
    img = imutils.resize(img, width=1280)
    cv2.imshow('image' , img)
    

    hope that helps, good luck !

提交回复
热议问题