解决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)
相关推荐
嘿丨嘿44 分钟前
VLA 入门(六):VLA 如何进行强化学习后训练?
人工智能·python·深度学习·机器人
祉猷并茂,雯华若锦1 小时前
Appium 3.x实战:获取元素属性全解析
python·appium·自动化
宠友信息2 小时前
消息序号如何保证即时通讯源码聊天记录稳定加载
java·spring boot·redis·python·mysql·uni-app
小柯南敲键盘2 小时前
批量图片翻译与视频字幕一站式解决高效跨境电商沟通难题
大数据·人工智能·python·音视频
smj2302_796826524 小时前
解决leetcode第3989题网格中保持一致的最大列数
python·算法·leetcode
吴梓穆5 小时前
Python 基础 正则表达式
python
巧克力男孩dd5 小时前
Python超典型练习题(第一次作业)
开发语言·python·算法
闲猫6 小时前
LangChain / Core components / Models
开发语言·python·langchain
cui_ruicheng9 小时前
Python从入门到实战(十三):模块、包与环境管理
开发语言·python
李宸净9 小时前
Web自动化测试selenium+python
前端·python·selenium