b64_image.py 218 Bytes
from base64 import b64decode
import cv2
import numpy as np


def to_img(b64_str: str):
    binary = b64decode(b64_str)
    np_array = np.frombuffer(binary, np.uint8)
    return cv2.imdecode(np_array, cv2.IMREAD_COLOR)