Error (-215) size.width>0 && size.height>0 occurred when attempting to display an image using OpenCV

后端 未结 11 2583
渐次进展
渐次进展 2020-11-28 15:37

I am trying to run a simple program that reads an image from OpenCV. However, I am getting this error:

error: ......\\modules\\highgui\\src\\window.cpp:281:          


        
11条回答
  •  死守一世寂寞
    2020-11-28 16:18

    I think it depends on the IDE + path of the image location issues

    1. In python IDLE you can directly run file from same folder where picture is there
    example 
    img = cv2.imread("kang34.jpg", 0)  # direct use 
    
    1. In IntelliJ IDEA you have to give full path of the image where picture is located
    example 
    img = cv2.imread("C:\\Users\\DEBASISH\\AppData\\Local\\Programs\\Python\\Python36\\Projects\\kang34.jpg", 0)  # use proper syntax and full path of image location
    

提交回复
热议问题