Python3.5+OpenCV3.2读取图像问题

来源:互联网 发布:职称计算机模拟软件 编辑:程序博客网 时间:2024/05/22 15:46

由于编码原因,opencv3.2无法用imread\imwrite直接读写含有中文字符的图像路径,因此读写要用以下2个方法:

import cv2 as c
import numpy as np
img=c.imdecode(np.fromfile(path,dtype=np.uint8),0)#读。最后一个参数:0-灰度,1-彩色
c.imencode('.jpg',img)[1].tofile(path1)#

阅读全文
1 0