由于編碼原因,opencv3.2無法用imread\imwrite直接讀寫含有中文字符的圖像路徑,
因此讀寫要用以下2個方法:
1
2
3
4
5
6
7
|
import cv2 as c import numpy as np img = c.imdecode(np.fromfile(path,dtype = np.uint8), 0 ) # 讀。最后一個參數(shù):0-灰度,1-彩色 c.imencode( '.jpg' ,img)[ 1 ].tofile(path1) # 寫 |
以上這篇解決Python3.5+OpenCV3.2讀取圖像的問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持服務(wù)器之家。
原文鏈接:https://blog.csdn.net/u010627377/article/details/72388973