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

前端 未结 6 1794
借酒劲吻你
借酒劲吻你 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:33

    Make sure the input_img's resolution is not zero, i.e, (0,0,number_of_channels) which means it is not finding any image. So add the following checking before performing operations on it:

    if input_img.shape[0]!=0 and input_img.shape[1]!=0:
        #operations on input_img
    

提交回复
热议问题