1.当要处理的图片路径中带有中文的图片时,直接cv2.imwrite()或者cv2.imread()会失败
2.解决方法
import cv2
import numpy as np
cv_img = cv2.imdecode(np.fromfile(file_path,dtype=np.uint8),-1) #读取
cv2.imencode('.jpg', cv_img )[1].tofile(file_path) #写入
1.当要处理的图片路径中带有中文的图片时,直接cv2.imwrite()或者cv2.imread()会失败
2.解决方法
import cv2
import numpy as np
cv_img = cv2.imdecode(np.fromfile(file_path,dtype=np.uint8),-1) #读取
cv2.imencode('.jpg', cv_img )[1].tofile(file_path) #写入