2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > opencv读取中文路径图片

opencv读取中文路径图片

时间:2022-12-05 09:23:46

相关推荐

opencv读取中文路径图片

opencv c++是支持中文的,

opencv python不支持的情况:

1.路径中含有中文。

2.路径中含有特殊字符,比如π

读取图片

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

img=cv2.imdecode(np.fromfile(img_path, dtype=np.uint8),-1)# 读入完整图片,见下面解释

img=cv2.imdecode(np.fromfile(img_path, dtype=np.uint8),0)# 读成灰度

img=cv2.imdecode(np.fromfile(img_path, dtype=np.uint8),1)# 读成彩图

其中:img_path为读取图片路径及图片名,可以包含中文

保存图片

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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。