Error while resizing image: "error: (-215:Assertion failed) func != 0 in function 'resize'"
Oh, I actually figured it out. Images in the dataset were of type numpy.int64
. I just had to convert images to float32
, like this:
def resize_dataset(images):
resized_images = []
for img in images:
img = img.reshape((28,28)).astype('float32') # <-- convert image to float32
resized_img = cv2.resize(img, dsize=(10, 10))
resized_images.append(resized_img)
return numpy.array(resized_images)
And now it works nicely. It looks like cv2.resize
can't work with images represented in int. Hope this will help anyone