Instantly share code, notes, and snippets.

Embed
What would you like to do?
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()
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