-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
42 lines (32 loc) · 987 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Author: Rodolfo Ferro @ Datlacuache
Twitter: @rodo_ferro
Script: Main script.
"""
from tools.dataset import extract_frames_from_folder
from tools.facial import extract_faces_from_image
from tools.dataset import extract_frames_from_video
def main():
"""Main function."""
# Input directory
input_dir = 'assets'
# Output directory
output_dir = 'frames'
# Extract frames
extract_frames_from_folder(
input_dir,
output_dir,
prefix_name='img',
starting_id=1,
frame_step=30, # Used for fps
extension='png')
if __name__ == '__main__':
# Run main function
# main()
# Extract faces
extract_faces_from_image('assets/frames/img_0000011867.jpg',
'haarcascades/haarcascade_frontalface_alt.xml',
'faces')
# Extract frames from video
# extract_frames_from_video('assets/sesion.mp4',
# 'assets/frames')