Opencv-python-resizing Image
Tryin'to resize the image but got an error saying. TypeError: resize() missing 1 required positional argument: 'image'. line 11, in img = resize(img, width = 1280)
Solution 1:
You need to say the height and the width too. :)
resized_image = cv2.resize(image, (800, 250)) # for example
First is width (800) and the second is height (250)
EDIT
Maybe your code can work (I don't know) but you have forgotten cv2.
before resize but I recomend you write width and height.
Solution 2:
The function resize(image, window_height)
that you defined is not a method, so it should not have the self
argument.
import cv2
def resize(image, window_height = 500):
aspect_ratio = float(image.shape[1])/float(image.shape[0])
window_width = window_height/aspect_ratioimage= cv2.resize(image, (int(window_height),int(window_width)))
return image
When removing self
, your code runs.
Post a Comment for "Opencv-python-resizing Image"