解决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)
相关推荐
莓有烦恼吖9 分钟前
Vibe Coding 的一些思考
python
小白学大数据11 分钟前
超简单:用 Python 让 Excel 飞起来:用 openpyxl 把重复报表整理交给脚本
开发语言·数据库·python·excel
爱丶不疚27 分钟前
写给前端工程师的现代 Python 工程化最佳实践:从 pnpm 到 uv,从 CommonJS 到 src-layout
javascript·python·typescript
2601_962297251 小时前
C# vs Java vs Python:YOLO工业部署性能对比实战
java·python·c·工业视觉·性能对比
CTA终结者1 小时前
示例、拆解和练习,要连成一条量化补课线
人工智能·python
lolijiaqi151 小时前
一线观察:长期体验后发现的医疗器械 CDMO 底层现象
大数据·python
spencer_tseng2 小时前
[j2cache ehcache.xml]/tmp/.ehcache-diskstore.lock (Permission denied)
xml·linux·python·ehcache·[j2cache
具身AGI2 小时前
模型懂物理吗?物理AI 物理推理 的新赛点
人工智能·深度学习·计算机视觉
梦想不只是梦与想2 小时前
Python Web 框架:FastAPI
python·fastapi·web框架
玩大数据的龙威3 小时前
农经权二轮延包—全面取代人工公示图生成
python·arcgis