python3 opencv中文路径图片读取和写入 离殇花开 2021-10-26 396 阅读1分钟 问题描述 cv2.imread路径为中文时返回None。 方案 读取(先用np.fromfile读取为np.uint8格式,再使用cv2.imdecode解码): # 文件路径file_path,返回读取后的图片 cv_img = cv2.imdecode(np.fromfile(file_path,dtype=np.uint8),-1) 写入: cv2.imencode('.jpg',img)[1].tofile(file_path) 参考:www.zhihu.com/question/47…