forked from WenjieDu/eye_game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
35 lines (26 loc) · 812 Bytes
/
run.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
"""
This is where the overall program is run.
"""
import os
from pkg.parser import get_eyeball_direction
def main() -> None:
"""
This is the main function
"""
path_to_images = os.path.join(os.getcwd(), "images/")
filenames = os.listdir(path_to_images)
if filenames:
for file in filenames:
file_path = os.path.join(path_to_images, file)
# print(file_path)
try:
direction = get_eyeball_direction(file_path)
except: # pylint: disable=bare-except
direction = "opencv cannot find eyeballs"
print(
"Image submitted: {0}, Eyeball direction: {1}".format(file, direction)
)
else:
print("No images submitted")
if __name__ == "__main__":
main()