(-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

四行代码

import cv2
img = cv2.imread('土拨鼠.jpg')
cv2.imshow('土拨鼠.jpg',img)
cv2.waitKey(0)

 

疯狂报错

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-2-7498fecfeb44> in <module>
      1 import cv2
      2 img = cv2.imread('土拨鼠.jpg')
----> 3 cv2.imshow('土拨鼠.jpg',img)
      4 cv2.waitKey(0)

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\highgui\src\window.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'


打印img,发现它是的,说明文件读取失败了,将文件路径改成绝对路径依然不行,

最后,

文件名改成英文就好了

展开阅读全文

没有更多推荐了,返回首页