Skip to content

Instantly share code, notes, and snippets.

@HoweChen
Last active March 19, 2024 20:20
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save HoweChen/7cdd09b08147133d8e1fbe9b52c24768 to your computer and use it in GitHub Desktop.
Save HoweChen/7cdd09b08147133d8e1fbe9b52c24768 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)
@samuelastech
Copy link

I was looking for it!

@jasperan
Copy link

jasperan commented Jan 5, 2024

Simple and it works

@iamargentum
Copy link

thank you kind stranger!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment