Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bernhard Heinloth
Yet Another CovPass Checker
Commits
7f948d0c
Commit
7f948d0c
authored
Oct 06, 2021
by
Bernhard Heinloth
Browse files
Fix webcam
parent
5cba7e64
Changes
1
Hide whitespace changes
Inline
Side-by-side
run.py
View file @
7f948d0c
...
@@ -11,11 +11,20 @@ import numpy as np
...
@@ -11,11 +11,20 @@ import numpy as np
import
cv2
import
cv2
import
unicodedata
import
unicodedata
cap
=
cv2
.
VideoCapture
(
0
)
# Webcam
cap
.
set
(
cv2
.
CAP_PROP_FRAME_WIDTH
,
640
)
# device (X = /dev/videoX)
cap
.
set
(
cv2
.
CAP_PROP_FRAME_HEIGHT
,
480
)
WEBCAM_DEVICE
=
0
WEBCAM_WIDTH
=
1280
WEBCAM_HEIGHT
=
720
WINDOW_NAME
=
'CovPass Check'
cap
=
cv2
.
VideoCapture
(
WEBCAM_DEVICE
)
cap
.
set
(
cv2
.
CAP_PROP_FRAME_WIDTH
,
WEBCAM_WIDTH
)
cap
.
set
(
cv2
.
CAP_PROP_FRAME_HEIGHT
,
WEBCAM_HEIGHT
)
font_simplex
=
cv2
.
FONT_HERSHEY_SIMPLEX
font_simplex
=
cv2
.
FONT_HERSHEY_SIMPLEX
font_duplex
=
cv2
.
FONT_HERSHEY_DUPLEX
font_duplex
=
cv2
.
FONT_HERSHEY_DUPLEX
cv2
.
namedWindow
(
WINDOW_NAME
,
cv2
.
WINDOW_NORMAL
)
qrcodes
=
{}
qrcodes
=
{}
process
=
[]
process
=
[]
...
@@ -60,9 +69,10 @@ if len(sys.argv) > 1:
...
@@ -60,9 +69,10 @@ if len(sys.argv) > 1:
allowed
.
append
(
normalize
(
line
).
split
(
";"
))
allowed
.
append
(
normalize
(
line
).
split
(
";"
))
print
(
"Only allowed person"
)
print
(
"Only allowed person"
)
if
not
(
cap
.
isOpened
()):
if
not
cap
.
isOpened
():
cap
.
open
(
device
)
cap
.
open
(
WEBCAM_DEVICE
)
while
(
cap
.
isOpened
()):
while
cap
.
isOpened
():
# Capture frame-by-frame
# Capture frame-by-frame
ret
,
frame
=
cap
.
read
()
ret
,
frame
=
cap
.
read
()
# Our operations on the frame come here
# Our operations on the frame come here
...
@@ -110,7 +120,7 @@ while(cap.isOpened()):
...
@@ -110,7 +120,7 @@ while(cap.isOpened()):
# Full counter
# Full counter
cv2
.
putText
(
frame
,
str
(
validusers
),
(
10
,
60
),
cv2
.
FONT_HERSHEY_DUPLEX
,
2
,
(
119
,
155
,
0
),
4
,
cv2
.
LINE_AA
)
cv2
.
putText
(
frame
,
str
(
validusers
),
(
10
,
60
),
cv2
.
FONT_HERSHEY_DUPLEX
,
2
,
(
119
,
155
,
0
),
4
,
cv2
.
LINE_AA
)
# Display the resulting frame
# Display the resulting frame
cv2
.
imshow
(
'frame'
,
frame
)
cv2
.
imshow
(
WINDOW_NAME
,
frame
)
# Check unprocessed qr codes
# Check unprocessed qr codes
for
ehc_code
in
process
:
for
ehc_code
in
process
:
...
...
Write
Preview
Supports
Markdown
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