1. 程式人生 > >(-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

(-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,發現它是的,說明檔案讀取失敗了,將檔案路徑改成絕對路徑依然不行,

最後,

檔名改成英文就好了