[solved] Python: opencv: error: (- 215) size.width >0 && size.height >0 in function cv::imshow

when using cv2.imread(),
when this error occurs, please check the following information:
is spelling error
is this picture
is added suffix
is 0 absolute path 1
2 what system is this?Consider changing the single slash to and double slash . In general, a backslash
is already supported

image_data = cv2.imread('D:\\lab\\AgriculturalDisease_trainingset\\images\\00c5c908-fc25-4710-a109-db143da23112___RS_Erly.B 7778.JPG')

in Windows how to check the address is correct, especially in the loop
can be copied directly in the Windows window, to see if you can read and display the picture.
then checks the address of the program, prints it out, and compares whether the two are the same.

if you encounter Chinese name can’t read, please refer to this website: Chinese path error problem
simply, is to directly rewrite the cv2.imread function, replace it with another function cv_imread:

def cv_imread(filePath):
    return cv_img

# The main citation section is as follows: (img_path needs to be given by yourself)
image_data = cv_imread(img_path)

Read More: