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
Frank Tjado Ihmels
medienverarbeitung17.projectmood
Commits
ea20e14b
Commit
ea20e14b
authored
Dec 06, 2017
by
tihmels
Browse files
MultiScaleFactor verändert
parent
9870a0ec
Changes
1
Show whitespace changes
Inline
Side-by-side
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
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