python opencv读取中文路径的完美替代
import cv2
import numpy as np
def cv2imread(img_path):
return cv2.imdecode(np.fromfile(img_path, dtype=np.uint8), -1)
# 中文问题
def cv2imwrite(filename):
cv2.imencode('.jpg', img)[1].tofile(filename)
python opencv读取中文路径的完美替代
import cv2
import numpy as np
def cv2imread(img_path):
return cv2.imdecode(np.fromfile(img_path, dtype=np.uint8), -1)
# 中文问题
def cv2imwrite(filename):
cv2.imencode('.jpg', img)[1].tofile(filename)