python3 opencv中文路径图片读取和写入

问题描述 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)[
相关文章
相关标签/搜索