base64和opencv格式转换
f = open(path, 'rb') #读入缓存
img = base64.b64encode(f.read()) #bytes
#转换为opencv格式
img_b64decode = base64.b64decode(img) # base64解码
img_array = np.fromstring(img_b64decode, np.uint8) # 转换np序列
imgCv = cv2.imdecode(img_array, cv2.COLOR_BGR2RGB) # 转换Opencv格式
print(imgCv.shape)
#opencv格式换位base64
image = cv2.imencode('.jpg', imgCv)[1]
base64_data = str(base64.b64encode(image))[2:-1]