Skip to content

Instantly share code, notes, and snippets.

@samuelastech
Forked from HoweChen/opencv_from_base64.py
Created October 7, 2022 19:09
Show Gist options
  • Save samuelastech/d66f2091916a684d54563ef2ae728ece to your computer and use it in GitHub Desktop.
Save samuelastech/d66f2091916a684d54563ef2ae728ece to your computer and use it in GitHub Desktop.
[opencv_from_base64]read image from opencv with base64 encoding #OpenCV
import cv2
import numpy as np
import base64
image = "" # raw data with base64 encoding
decoded_data = base64.b64decode(image)
np_data = np.fromstring(decoded_data,np.uint8)
img = cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
cv2.imshow("test", img)
cv2.waitKey(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment