mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Cleaned up example file.
This commit is contained in:
parent
5f26972551
commit
7e94daad4d
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user