-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
49 lines (32 loc) · 1 KB
/
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
43
44
45
46
47
48
49
import os
import shutil
from pathlib import Path
import cv2
import to_edged
import to_frames
import to_terminal
def main():
print("===================================================")
print("Enter your source video.")
while True:
src = input().strip()
if os.path.exists(src):
break
print("That file does not exist. Try again.")
# get the parent folder to do stuff in
parent = Path(src).parent.absolute()
print("Applying edge detection...")
# convert to edged video
to_edged.to_edged_video(src, parent)
print()
print("Converting frames...")
# create folder with all frames as pngs
# isn't done on the fly to ensure the console can play the video at preferred fps
folder, video = to_frames.to_frames(src, parent)
print()
print("All good now. Enjoy the show!")
to_terminal.play(folder, video)
# remove folder with frames
shutil.rmtree(folder, ignore_errors=True)
if __name__ == '__main__':
main()