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
ec6fc745
Commit
ec6fc745
authored
Dec 13, 2017
by
tihmels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring
parent
3fe71c84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
projectmood/webcam.py
projectmood/webcam.py
+2
-4
No files found.
projectmood/webcam.py
View file @
ec6fc745
...
...
@@ -22,7 +22,7 @@ def _load_emoticons(emotions):
return
[
nparray_as_image
(
cv2
.
imread
(
'resources/graphics/%s.png'
%
emotion
,
-
1
),
mode
=
None
)
for
emotion
in
emotions
]
def
show_webcam_and_run
(
model
,
emoticons
,
window_size
=
None
,
window_name
=
'webcam'
,
update_time
=
10
):
def
show_webcam_and_run
(
model
,
emoticons
,
window_size
=
(
800
,
800
),
window_name
=
'Mood Expression'
,
update_time
=
1
):
"""
Shows webcam image, detects faces and its emotions in real time and draw emoticons over those faces.
:param model: Learnt emotion detection model.
...
...
@@ -65,10 +65,8 @@ if __name__ == '__main__':
emotions
=
[
'neutral'
,
'anger'
,
'disgust'
,
'happy'
,
'surprise'
]
emoticons
=
_load_emoticons
(
emotions
)
# load mode
fisher_face
=
cv2
.
face
.
FisherFaceRecognizer_create
()
fisher_face
.
read
(
'basis_data/models/detection_model.xml'
)
# use learnt model
window_name
=
'WEBCAM (press ESC to exit)'
show_webcam_and_run
(
fisher_face
,
emoticons
,
window_size
=
(
800
,
800
),
window_name
=
window_name
,
update_time
=
1
)
show_webcam_and_run
(
fisher_face
,
emoticons
)
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