import cv2
import numpy as np
#读中文路径图片
img = cv2.imdecode(np.fromfile(img_path,dtype=np.uint8),-1)
#判断图片是否为空
if len(np.fromfile(img_path,dtype=np.uint8))==0:
print('无效图片')
#存中文路径图片
cv2.imencode('.jpg', img )[1].tofile(img_path)
import cv2
import numpy as np
#读中文路径图片
img = cv2.imdecode(np.fromfile(img_path,dtype=np.uint8),-1)
#判断图片是否为空
if len(np.fromfile(img_path,dtype=np.uint8))==0:
print('无效图片')
#存中文路径图片
cv2.imencode('.jpg', img )[1].tofile(img_path)