参考:opencv_python使用cv2.imread()读取中文路径报错问题
def cv_imread(filePath):
cv_img=cv2.imdecode(np.fromfile(filePath,dtype=np.uint8),-1)
return cv_img
if __name__=='__main__':
path='E:/images/百合/百合1.jpg'
img=cv_imread(path)
cv2.namedWindow('lena',cv2.WINDOW_AUTOSIZE)
cv2.imshow('lena',img)
k=cv2.waitKey(0)
##这样是保存到了和当前运行目录下
cv2.imencode('.jpg', img)[1].tofile('百合.jpg')
网友评论