python opencv读取中文路径的完美替代

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) 
    

猜你喜欢

转载自blog.csdn.net/phker/article/details/109223731