Open the image in Python is always an error
error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:352:
error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
1 import cv2 as cv 2 img = cv.imread('D:\BjutDeeplearning\Opencvtest\python-opencv05\\black.jpg') 3 cv.imshow("img", img) 4 print(img.shape) 5 cv.waitKey(0) 6 cv.destroyAllWindows()
Note three:
Pictures on the path of non-Chinese reading,
Picture instead a non-Chinese name,
Double front picture name or the path \\ preceded by r, the original string:
r'D:\BjutDeeplearning\Opencvtest\python-opencv05\black.jpg'。