解决cv2. imread、imwrite无法读取或保存中文路径图片问题

cv2.imwrite(filename, img)
修改为
cv2.imencode('.jpg', img)[1].tofile(filename)

cv2.imread(filename, cv2.IMREAD_GRAYSCALE)
修改为
cv2.imdecode(np.fromfile(filename, dtype=np.uint8), cv2.IMREAD_GRAYSCALE)

posted @ 2023-03-06 11:28  天天代码码天天  阅读(277)  评论(0编辑  收藏  举报  来源