解决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)
相关推荐
阿童木写作2 小时前
TikTok Shop视频翻译工具实战测评
人工智能·python·音视频
circuitsosk2 小时前
大模型驱动的AI产品后端架构设计与实践
人工智能·python
JackSparrow4142 小时前
前端安全之JS混淆+请求加密+请求签名以提升爬虫难度
前端·javascript·后端·爬虫·python·安全
软糖姐姐2 小时前
python eureka服务发现_python与consul 实现gRPC服务注册-发现
python·consul·grpc·服务注册·发现
听雨入夜3 小时前
zero.zhang
开发语言·python
叶 落4 小时前
Mac 通过 Miniconda 安装 Python
python·macos·conda·miniconda
就改了10 小时前
Java8 日期处理(详细版)
java·python·算法
威联通安全存储13 小时前
TS-h1887XU-RP在汽车发动机热试与NVH在线质检网中的部署
python·汽车
qq_3164110314 小时前
腹腔镜模拟手术训练数字化管理平台构建
人工智能·python·深度学习·机器学习
卷无止境14 小时前
PageIndex:把RAG的检索逻辑从"找相似"改成了"讲道理"
后端·python