如下所示:
1
2
3
4
5
6
|
import cv2
import numpy as np
cv2.imshow( "1" ,img)
cv2.waitKey( 10000 )
|
1
2
3
4
5
6
7
8
9
|
D:\>my.py
OpenCV Error: Assertion failed (size.width> 0 && size.height> 0 ) in cv::imshow, file C:\build\master_winpack - bindings - win64 - vc14 - static\opencv\modules\highgui\src\window.cpp, line 325
Traceback (most recent call last):
File "D:\my.py" , line 5 , in <module>
cv2.imshow( "1" ,img)
cv2.error: C:\build\master_winpack - bindings - win64 - vc14 - static\opencv\modules\highgui\src\window.cpp: 325 : error: ( - 215 ) size.width> 0 && size.height> 0 in function cv::imshow
D:\>
|
以上这篇解决python测试opencv时imread导致的错误问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/QQ962662562/article/details/77743814