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

yipeiwu_com6年前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使用正则表达式检测密码强度源码分享

复制代码 代码如下:#encoding=utf-8#-------------------------------------------------------------------...

浅析python递归函数和河内塔问题

关于递归函数:   函数内部调用自身的函数。 以n阶乘为例:   f(n) = n ! = 1 x 2 x 3 x 4 x...x(n-1)x(n) = n x (n-1) ! de...

python 使用sys.stdin和fileinput读入标准输入的方法

1、使用sys.stdin 读取标准输入 [root@c6-ansible-20 script]# cat demo02.py #! /usr/bin/env python fro...

Python中使用item()方法遍历字典的例子

Python中使用item()方法遍历字典的例子

Python字典的遍历方法有好几种,其中一种是for...in,这个我就不说明,在Python了几乎随处都可见for...in。下面说的这种遍历方式是item()方法。 item() i...

Python多线程中阻塞(join)与锁(Lock)使用误区解析

关于阻塞主线程 join的错误用法 Thread.join() 作用为阻塞主线程,即在子线程未返回的时候,主线程等待其返回然后再继续执行. join不能与start在循环里连用 以下为...