-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
24 lines (18 loc) · 933 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Facial Landmarks Detection and Extraction
import os
from face_landmarks_detection import initialize_face_detection, process_input_image, face_detector
from file_handler import dataset_path, shape_predictor_path, get_file_path, is_valid_file, clear_results
# initialize the project
def initialize():
# get Dlib shape detector and predictor
[detector, predictor] = initialize_face_detection(shape_predictor_path)
# loop over images in dataset
for file_name in os.listdir(dataset_path):
if is_valid_file(dataset_path + file_name, file_name):
[image_path, image_segments_dir] = get_file_path(file_name)
[resized_image, gray_image] = process_input_image(image_path)
face_detector(detector, predictor, resized_image, gray_image, image_segments_dir)
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
clear_results()
initialize()