Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
7e94daad
Commit
7e94daad
authored
Sep 19, 2017
by
Varun Chatterji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up example file.
parent
5f269725
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
face_alignment.py
python_examples/face_alignment.py
+7
-12
No files found.
python_examples/face_alignment.py
View file @
7e94daad
...
@@ -27,31 +27,26 @@
...
@@ -27,31 +27,26 @@
# Or downloaded from http://opencv.org/releases.html
# Or downloaded from http://opencv.org/releases.html
import
sys
import
sys
import
os
import
dlib
import
dlib
import
glob
import
cv2
import
cv2
import
numpy
as
np
import
numpy
as
np
if
len
(
sys
.
argv
)
!=
4
:
if
len
(
sys
.
argv
)
!=
3
:
print
(
print
(
"Call this program like this:
\n
"
"Call this program like this:
\n
"
" ./face_alignment.py shape_predictor_5_face_landmarks.dat dlib_face_recognition_resnet_model_v1.dat ../examples/faces/bald_guys.jpg
\n
"
" ./face_alignment.py shape_predictor_5_face_landmarks.dat ../examples/faces/bald_guys.jpg
\n
"
"You can download a trained facial shape predictor and recognition model from:
\n
"
"You can download a trained facial shape predictor from:
\n
"
" http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2
\n
"
" http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2
\n
"
)
" http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2"
)
exit
()
exit
()
predictor_path
=
sys
.
argv
[
1
]
predictor_path
=
sys
.
argv
[
1
]
face_rec_model_path
=
sys
.
argv
[
2
]
face_file_path
=
sys
.
argv
[
2
]
face_file_path
=
sys
.
argv
[
3
]
# Load all the models we need: a detector to find the faces, a shape predictor
# Load all the models we need: a detector to find the faces, a shape predictor
# to find face landmarks so we can precisely localize the face, and finally the
# to find face landmarks so we can precisely localize the face
# face recognition model.
detector
=
dlib
.
get_frontal_face_detector
()
detector
=
dlib
.
get_frontal_face_detector
()
sp
=
dlib
.
shape_predictor
(
predictor_path
)
sp
=
dlib
.
shape_predictor
(
predictor_path
)
facerec
=
dlib
.
face_recognition_model_v1
(
face_rec_model_path
)
# Load the image using OpenCV
# Load the image using OpenCV
bgr_img
=
cv2
.
imread
(
face_file_path
)
bgr_img
=
cv2
.
imread
(
face_file_path
)
...
...
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