10/19/2019

Byte 2 opencv Mat


refer to below source code. ^^

import base64
import numpy as np
import cv2

def byte2Mat(data):
    imgdata = base64.b64decode(data)
    nparr = np.frombuffer(imgdata, np.uint8)
    img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
    print(img.shape)
    
    return img    

No comments:

Post a Comment