This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import cv2 | |
from PIL import Image | |
cap = cv2.VideoCapture(0) | |
_, img = cap.read() | |
image_string = cv2.imencode(".png", img)[1].tostring() | |
output = io.BytesIO() | |
Image.fromarray(img).save(output, format='PNG') | |
buf = output.getvalue() | |
b64 = base64.b64encode(buf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from PIL import Image | |
from io import BytesIO | |
import numpy as np | |
res = requests.get(image_url) | |
image = Image.open(BytesIO(res.content)) | |
image_array = np.array(image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment