base64编码的图片转换为numpy格式或者opencv格式
flyfish
base64编码的图片转换为numpy格式或者opencv格式
base64编码
image_path = './test_image/test1.jpg'
img_file = open(image_path,'rb')
img_b64encode = base64.b64encode(img_file.read())
base64解码
img_b64decode = base64.b64decode(img_raw_base64) # base64解码
img_array = np.fromstring(img_b64decode,np.uint8) # 转换np序列
img_raw=cv2.imdecode(img_array,cv2.IMREAD_COLOR) # 转换Opencv格式 BGR