python3 opencv中文路徑圖片讀取和寫入

問題描述 cv2.imread路徑爲中文時返回None。 方案 讀取(先用np.fromfile讀取爲np.uint8格式,再使用cv2.imdecode解碼): # 文件路徑file_path,返回讀取後的圖片 cv_img = cv2.imdecode(np.fromfile(file_path,dtype=np.uint8),-1) 寫入: cv2.imencode('.jpg',img)[
相關文章
相關標籤/搜索