解决python测试opencv时imread导致的错误问题
程序员文章站
2023-12-09 13:17:39
如下所示:
import cv2
import numpy as np
img = cv2.imread("1.jpg")//图片和代码在同个目录,改为...
如下所示:
import cv2 import numpy as np img = cv2.imread("1.jpg")//图片和代码在同个目录,改为相对路径,解决由imread引起的打不开图片或找不到图片的路径问题 cv2.imshow("1",img) cv2.waitkey(10000)
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导致的错误问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。