解决python3中cv2读取中文路径的问题

yipeiwu_com7年前Python基础

如下所示:

python3:

img_path =  ' '

im = cv2.imdecode(np.fromfile(img_path,dtype = np.uint8),-1)

save_path =  ' '

cv2.imencode('.jpg',im)[1].tofile(save_path)


python2.7:

img_path = ' '

im = cv2.imread(img_path.decode(‘utf-8'))

以上这篇解决python3中cv2读取中文路径的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

python处理大数字的方法

本文实例讲述了python处理大数字的方法。分享给大家供大家参考。具体实现方法如下: def getFactorial(n): """returns the factorial...

python 自动批量打开网页的示例

如下所示: import webbrowser import codecs import time with open("test.txt") as fp: for ebayno...

python链接Oracle数据库的方法

本文实例讲述了python链接Oracle数据库的方法。分享给大家供大家参考。具体如下: 这里使用python链接Oracle数据库需要引用cx_Oracle库 #coding=UT...

python解析文件示例

python最近的工作主要是组件兼容性测试,原有的框架有很多功能还不完善,需要补充!比如,需要将AutoIt脚本的执行结果写入到Excel中,最后的解决方案是使用本地的log来解析这个结...

python time模块用法实例详解

本文详细讲述了python的内嵌time模块的用法。分享给大家供大家参考之用。具体分析如下:   一、简介 time模块提供各种操作时间的函数 说明:一般有两种表示时间的方式...