解决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)

复制代码
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)
相关推荐
枫叶v.6 小时前
Agent 分层存储架构设计:从记忆方法到中间件选型
开发语言·python
水兵没月7 小时前
逆向实战小记——某ToB商城网站分析学习
python·网络爬虫
程序员小远7 小时前
Python自动化测试框架及工具详解
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试
sleven fung8 小时前
MinerU与BabelDOC与KTransformers与OpenAI API库
开发语言·python·ai·langchain
小毛驴8508 小时前
spring-boot-maven-plugin,maven-compiler-plugin 功能对比
java·python·maven
萤萤七悬8 小时前
【Python笔记】AI帮实现CLI工具-使用argparse.ArgumentParser接收命令参数
开发语言·笔记·python
郑洁文9 小时前
基于Python的Web命令执行漏洞自动化检测系统
前端·python·网络安全·自动化
yingjie1109 小时前
Scanpy vs Seurat 深度对比:Python 与 R 的单细胞分析框架谁更强?
开发语言·python·r语言·生物信息学·单细胞转录组·seurat·scanpy
包子BI大数据10 小时前
3.openclaw小龙虾简单版安装教程
人工智能·python·ai
程序大视界10 小时前
【Python系列课程】Pandas(四):数据统计与排序——describe、sort_values、sample
开发语言·python·pandas