From e522cfbce7b54460554205d3ec113bc385399415 Mon Sep 17 00:00:00 2001 From: mhmmdd Date: Sun, 17 May 2020 23:14:33 +0300 Subject: [PATCH] WebcamVideoStream should be like cv2.VideoCapture --- imutils/video/webcamvideostream.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/imutils/video/webcamvideostream.py b/imutils/video/webcamvideostream.py index dbe8751..88f9dbd 100644 --- a/imutils/video/webcamvideostream.py +++ b/imutils/video/webcamvideostream.py @@ -2,6 +2,7 @@ from threading import Thread import cv2 + class WebcamVideoStream: def __init__(self, src=0, name="WebcamVideoStream"): # initialize the video camera stream and read the first frame @@ -16,6 +17,12 @@ def __init__(self, src=0, name="WebcamVideoStream"): # be stopped self.stopped = False + def get(self, var1): + return self.stream.get(var1) + + def set(self, var1, var2): + return self.stream.set(var1, var2) + def start(self): # start the thread to read frames from the video stream t = Thread(target=self.update, name=self.name, args=()) @@ -35,7 +42,7 @@ def update(self): def read(self): # return the frame most recently read - return self.frame + return self.grabbed, self.frame def stop(self): # indicate that the thread should be stopped