python使用opencv读取图片失败

>>> import cv2
>>> img = cv2.imread('D:\test\8.png',cv2.IMREAD_COLOR)
>>> cv2.imshow('origin',img)
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file ..\..\..\..\opencv\modules\highgui\src\window.cpp, line 261
cv2.error: ..\..\..\..\opencv\modules\highgui\src\window.cpp:261: error: (-215) size.width>0 && size.height>0 in function cv::imshow

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

把图片路径改为r’D:\test\8.png’就好了。

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页