Commit c4eb2a94 authored by Arne Gerdes's avatar Arne Gerdes
Browse files

Neue Kommentare hinzugefügt

parent c9a3225f
from threading import Thread
import cv2
class WebcamVideoStream:
def __init__(self, src=0):
# initialize the video camera stream and read the first frame
# from the stream
initialisiere den Webcam Stream und liest den ersten Frame aus dem Stream
""" = cv2.VideoCapture(src)
(self.grabbed, self.frame) =
# initialize the variable used to indicate if the thread should
# be stopped
Initialisiere die Variable, die angibt, ob der Thread gestoppt werden soll
self.stopped = False
def start(self):
# start the thread to read frames from the video stream
starte den Thread, um Frames aus dem Webcam Stream zu lesen
Thread(target=self.update, args=()).start()
return self
def update(self):
# keep looping infinitely until the thread is stopped
Endloss Schleife, bis der Thread gestoppt wird
while True:
# if the thread indicator variable is set, stop the thread
Wenn die Thread-Indikator-Variable gesetzt ist, stoppt diese den Thread
if self.stopped:
# otherwise, read the next frame from the stream
Ansonsten wird der nächste Frame aus dem Stream gelesen
(self.grabbed, self.frame) =
def read(self):
# return the frame most recently read
gibt den zuletzt gelesenen Frame zurück
return self.frame
def stop(self):
# indicate that the thread should be stopped
gibt an, dass der Thread gestoppt werden soll
self.stopped = True
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment