Python opencv is a perfect alternative to read Chinese paths

Python opencv is a perfect alternative to read Chinese paths

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) 
    

Guess you like

Origin blog.csdn.net/phker/article/details/109223731