From 7e94daad4d40dc906666c2daeeec9e89ffa210e5 Mon Sep 17 00:00:00 2001 From: Varun Chatterji Date: Tue, 19 Sep 2017 23:08:54 +0800 Subject: [PATCH] Cleaned up example file. --- python_examples/face_alignment.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/python_examples/face_alignment.py b/python_examples/face_alignment.py index 9b15e179f..ba3b39f8e 100755 --- a/python_examples/face_alignment.py +++ b/python_examples/face_alignment.py @@ -27,31 +27,26 @@ # Or downloaded from http://opencv.org/releases.html import sys -import os + import dlib -import glob import cv2 import numpy as np -if len(sys.argv) != 4: +if len(sys.argv) != 3: print( "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" - "You can download a trained facial shape predictor and recognition model from:\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") + " ./face_alignment.py shape_predictor_5_face_landmarks.dat ../examples/faces/bald_guys.jpg\n" + "You can download a trained facial shape predictor from:\n" + " http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2\n") exit() predictor_path = sys.argv[1] -face_rec_model_path = sys.argv[2] -face_file_path = sys.argv[3] +face_file_path = sys.argv[2] # 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 -# face recognition model. +# to find face landmarks so we can precisely localize the face detector = dlib.get_frontal_face_detector() sp = dlib.shape_predictor(predictor_path) -facerec = dlib.face_recognition_model_v1(face_rec_model_path) # Load the image using OpenCV bgr_img = cv2.imread(face_file_path)