python3下解决cv2读取中文路径问题

python下解决cv2读取中文路径问题

  • python3解决
img_path =  ' '

im = cv2.imdecode(np.fromfile(img_path,dtype = np.uint8),-1)

save_path =  ' '

cv2.imencode('.jpg',im)[1].tofile(save_path)
  • python2解决
img_path = ' '

im = cv2.imread(img_path.decode(‘utf-8'))

猜你喜欢

转载自blog.csdn.net/lpj822/article/details/83244439