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
ea20e14b
Commit
ea20e14b
authored
Dec 06, 2017
by
tihmels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MultiScaleFactor verändert
parent
9870a0ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
projectmood/sorted_set_facedetector.py
projectmood/sorted_set_facedetector.py
+9
-5
No files found.
projectmood/sorted_set_facedetector.py
View file @
ea20e14b
...
...
@@ -10,21 +10,25 @@ emotions = ["neutral", "anger", "disgust", "happy", "surprise"] # Define emotio
def
detect_faces
(
emotion
):
files
=
glob
.
glob
(
'Basis_data/sorted_set/%s/*'
%
emotion
)
# Get list of all images with emotion
files
=
glob
.
glob
(
'Basis_data/sorted_set/%s/*
w
'
%
emotion
)
# Get list of all images with emotion
filenumber
=
0
for
f
in
files
:
frame
=
cv2
.
imread
(
f
)
# Open image
gray
=
cv2
.
cvtColor
(
frame
,
cv2
.
COLOR_BGR2GRAY
)
# Convert image to grayscale
scaleFactor
=
1.05
minNeighbors
=
10
minSize
=
(
20
,
20
)
# Detect face using 4 different classifiers
face
=
faceDet
.
detectMultiScale
(
gray
,
scaleFactor
=
1.1
,
minNeighbors
=
10
,
minSize
=
(
5
,
5
)
,
face
=
faceDet
.
detectMultiScale
(
gray
,
scaleFactor
,
minNeighbors
,
minSize
,
flags
=
cv2
.
CASCADE_SCALE_IMAGE
)
face_two
=
faceDet_two
.
detectMultiScale
(
gray
,
scaleFactor
=
1.1
,
minNeighbors
=
10
,
minSize
=
(
5
,
5
)
,
face_two
=
faceDet_two
.
detectMultiScale
(
gray
,
scaleFactor
,
minNeighbors
,
minSize
,
flags
=
cv2
.
CASCADE_SCALE_IMAGE
)
face_three
=
faceDet_three
.
detectMultiScale
(
gray
,
scaleFactor
=
1.1
,
minNeighbors
=
10
,
minSize
=
(
5
,
5
)
,
face_three
=
faceDet_three
.
detectMultiScale
(
gray
,
scaleFactor
,
minNeighbors
,
minSize
,
flags
=
cv2
.
CASCADE_SCALE_IMAGE
)
face_four
=
faceDet_four
.
detectMultiScale
(
gray
,
scaleFactor
=
1.1
,
minNeighbors
=
10
,
minSize
=
(
5
,
5
)
,
face_four
=
faceDet_four
.
detectMultiScale
(
gray
,
scaleFactor
,
minNeighbors
,
minSize
,
flags
=
cv2
.
CASCADE_SCALE_IMAGE
)
# Go over detected faces, stop at first detected face, return empty if no face.
...
...
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