cv2.error: ..\..\..\modules\highgui\src\window.cpp:281: error: (-215) size.width>0 && size.height>0

 

错误提示:

OpenCV Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file ..\..\..\modules\highgui\src\window.cpp, line 281
Traceback (most recent call last):
  File "C:/Users/Administrator/PycharmProjects/test3/1.py", line 9, in <module>
    cv2.imshow("250",img)
cv2.error: ..\..\..\modules\highgui\src\window.cpp:281: error: (-215) size.width>0 && size.height>0 in function cv::imshow
 

 

cv2.error: ..\..\..\modules\highgui\src\window.cpp:281: error: (-215) size.width>0 && size.height>0

 

意思是没找到图片,图片要求宽高都大于0.

解决办法:

将你想要显示的图片放到你的工程下,然后就可以运行了

 

cv2.error: ..\..\..\modules\highgui\src\window.cpp:281: error: (-215) size.width>0 && size.height>0