cv2---imread---error

when I use the cv2.imred() which is absolute path  path = r'C:\Users\hp\Desktop\常用Python代码\mycv2\998dcd7a46333361fff21eafd563b3d1.jpg',

it occurred  :    cv2.error: OpenCV(3.4.4) C:projectsopencv-pythonopencvmoduleshighguisrcwindow.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

but use the relative it's ok

this is my code:

#coding: utf-8
import cv2
import numpy as np


path = r'C:\Users\hp\Desktop\常用Python代码\mycv2\998dcd7a46333361fff21eafd563b3d1.jpg'
img = cv2.imread(path)

cv2.imshow("image", img)
cv2.waitKey(10000)
cv2.destroyAllWindows()

how to solve this problem?

reason:my absolute path has Chinese character 

and I change it, it works

#coding: utf-8
import cv2
import numpy as np


path = r'C:\Users\hp\Desktop\My_Python_Code\mycv2\998dcd7a46333361fff21eafd563b3d1.jpg'
img = cv2.imread(path)

cv2.imshow("image", img)
cv2.waitKey(10000)
cv2.destroyAllWindows()

原文地址:https://www.cnblogs.com/wal1317-59/p/11115398.html