123456789101112 |
- from base64 import b64decode
- import base64
- import numpy as np
- import cv2
- def base64_to_np(img_data):
- color_image_flag = 1
- img_data = img_data.split(',',1)[-1]
- return cv2.imdecode(np.fromstring(b64decode(img_data), dtype=np.uint8), color_image_flag)
- def get_b64(f):
- return base64.encodebytes(f).decode('utf-8')
|