Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
medienverarbeitung17.projectmood
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Frank Tjado Ihmels
medienverarbeitung17.projectmood
Commits
c4eb2a94
Commit
c4eb2a94
authored
Dec 19, 2017
by
Arne Gerdes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Neue Kommentare hinzugefügt
parent
c9a3225f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
projectmood/WebcamVideoStream.py
projectmood/WebcamVideoStream.py
+26
-11
No files found.
projectmood/WebcamVideoStream.py
View file @
c4eb2a94
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
"""
self
.
stream
=
cv2
.
VideoCapture
(
src
)
(
self
.
grabbed
,
self
.
frame
)
=
self
.
stream
.
read
()
# 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
:
return
# otherwise, read the next frame from the stream
"""
Ansonsten wird der nächste Frame aus dem Stream gelesen
"""
(
self
.
grabbed
,
self
.
frame
)
=
self
.
stream
.
read
()
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
self
.
stopped
=
True
\ No newline at end of file
"""
gibt an, dass der Thread gestoppt werden soll
"""
self
.
stopped
=
True
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment