When many small partners use python's opencv (cv2), they must have encountered the problem of failure to read pictures in Chinese paths. Because direct use of cv2.imread(filename) does not support Chinese paths.
Here is the python code that can read and save Chinese path pictures directly with cv2:
import cv2
import numpy as np
def cv_imread(file_path):
cv_img = cv2.imdecode(np.fromfile(file_path,dtype=np.uint8),-1)
return cv_img
imgurl='测试.jpg'
img1 = cv_imread(imgurl)
cv2.imencode('.jpg', img1 )[1].tofile(imgurl)