error: (-215) ssize.width > 0 && ssize.height > 0 in function resize

前端 未结 6 1791
借酒劲吻你
借酒劲吻你 2020-12-10 07:09

I am building an image processing classifier. This line is giving me an error:

input_img_resize=cv2.resize(input_img,(128,128))

The error:

6条回答
  •  感情败类
    2020-12-10 07:39

    Well, obviously this line input_img=cv2.imread(data_path + '/'+ dataset + '/'+ img ) returns an empty array.

    You should check whether the image exists first before reading. And it is better not to use string combination to join file paths, use python os.path.join instead.

    image_path = os.path.join(data_path, dataset, img)
    if os.path.exist():
        # Do stuff
    

提交回复
热议问题