Spaces:
Sleeping
Sleeping
File size: 372 Bytes
ce14d19 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import cv2
class VideoCamera(object):
def __init__(self):
self.video = cv2.VideoCapture(0)
def __del__(self):
self.video.release()
def get_frame(self):
success, image = self.video.read()
if not success:
return b''
ret, jpeg = cv2.imencode('.jpg', image)
return jpeg.tobytes() |